mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Add score, percent_rank to topics. Adds HotTopic
model and consolidated job to calculate
hotness. Note: People on Heroku will have to update their jobs to the new structure in Heroku.md
This commit is contained in:
parent
9b103e6d97
commit
473a64d39d
20 changed files with 224 additions and 109 deletions
|
@ -123,11 +123,9 @@ class TopicQuery
|
|||
|
||||
def list_hot
|
||||
return_list(unordered: true) do |list|
|
||||
|
||||
# Let's not include topic categories on hot
|
||||
list = list.where("categories.topic_id <> topics.id")
|
||||
|
||||
list =list.order("coalesce(categories.hotness, 5) desc, topics.bumped_at desc")
|
||||
# Find hot topics
|
||||
list = list.joins(:hot_topic)
|
||||
.order('hot_topics.score + (COALESCE(categories.hotness, 5.0) / 11.0) desc')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue