mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
slight adjustment to suggestions
This commit is contained in:
parent
39a7b93cc1
commit
6c4cacbd3e
1 changed files with 2 additions and 2 deletions
|
@ -91,7 +91,7 @@ class Site < Sequel::Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SUGGESTIONS_LIMIT = 32
|
SUGGESTIONS_LIMIT = 30
|
||||||
SUGGESTIONS_VIEWS_MIN = 500
|
SUGGESTIONS_VIEWS_MIN = 500
|
||||||
CHILD_SITES_MAX = 100
|
CHILD_SITES_MAX = 100
|
||||||
|
|
||||||
|
@ -902,7 +902,7 @@ class Site < Sequel::Model
|
||||||
suggestions_dataset = Site.exclude(id: id).order(:views.desc, :updated_at.desc)
|
suggestions_dataset = Site.exclude(id: id).order(:views.desc, :updated_at.desc)
|
||||||
suggestions = suggestions_dataset.where(tags: tags).limit(limit, offset).all
|
suggestions = suggestions_dataset.where(tags: tags).limit(limit, offset).all
|
||||||
|
|
||||||
return suggestions if suggestions.length == 32
|
return suggestions if suggestions.length == limit
|
||||||
|
|
||||||
suggestions += suggestions_dataset.where("views >= #{SUGGESTIONS_VIEWS_MIN}").limit(limit-suggestions.length).order(Sequel.lit('RANDOM()')).all
|
suggestions += suggestions_dataset.where("views >= #{SUGGESTIONS_VIEWS_MIN}").limit(limit-suggestions.length).order(Sequel.lit('RANDOM()')).all
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue