mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
index score, filter site_changed for compute
This commit is contained in:
parent
a732cfda88
commit
b75116d13c
2 changed files with 10 additions and 1 deletions
9
migrations/077_decimal_sauce_index.rb
Normal file
9
migrations/077_decimal_sauce_index.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
Sequel.migration do
|
||||
up {
|
||||
DB.add_index :sites, :score
|
||||
}
|
||||
|
||||
down {
|
||||
DB.drop_index :sites, :score
|
||||
}
|
||||
end
|
|
@ -1077,7 +1077,7 @@ class Site < Sequel::Model
|
|||
end
|
||||
|
||||
def self.compute_scores
|
||||
select(:id, :username, :created_at, :updated_at, :views, :featured_at, :changed_count).exclude(is_banned: true).exclude(is_crashing: true).exclude(is_nsfw: true).exclude(updated_at: nil).all.each do |s|
|
||||
select(:id, :username, :created_at, :updated_at, :views, :featured_at, :changed_count).exclude(is_banned: true).exclude(is_crashing: true).exclude(is_nsfw: true).exclude(updated_at: nil).where(site_changed: true).all.each do |s|
|
||||
s.score = s.compute_score
|
||||
s.save_changes validate: false
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue