Hotness Score for Tags Should Use Article positive_reactions_count (#6808) [deploy]
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
This commit is contained in:
parent
f557c9d474
commit
2c49b34ebf
2 changed files with 9 additions and 1 deletions
|
|
@ -91,7 +91,7 @@ class Tag < ActsAsTaggableOn::Tag
|
|||
self.hotness_score = Article.tagged_with(name).
|
||||
where("articles.featured_number > ?", 7.days.ago.to_i).
|
||||
map do |article|
|
||||
(article.comments_count * 14) + (article.reactions_count * 4) + rand(6) + ((taggings_count + 1) / 2)
|
||||
(article.comments_count * 14) + article.score + rand(6) + ((taggings_count + 1) / 2)
|
||||
end.
|
||||
sum
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
module DataUpdateScripts
|
||||
class UpdateTagHotnessScores
|
||||
def run
|
||||
# Saving a tag will trigger calculate_hotness_score
|
||||
Tag.find_each(&:save)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue