Adjust article ranking algorithm to use crossposted_at where available (#1917)

This commit is contained in:
Ben Halpern 2019-02-27 07:41:52 -08:00 committed by GitHub
parent 32b20c6d95
commit f36b869228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,12 +3,13 @@ class BlackBox
def article_hotness_score(article)
return (article.featured_number || 10000) / 10000 unless Rails.env.production?
usable_date = article.crossposted_at || article.published_at
reaction_points = article.score
super_super_recent_bonus = article.published_at > 1.hours.ago ? 28 : 0
super_recent_bonus = article.published_at > 8.hours.ago ? 31 : 0
recency_bonus = article.published_at > 12.hours.ago ? 70 : 0
today_bonus = article.published_at > 26.hours.ago ? 385 : 0
two_day_bonus = article.published_at > 48.hours.ago ? 320 : 0
super_super_recent_bonus = usable_date > 1.hours.ago ? 28 : 0
super_recent_bonus = usable_date > 8.hours.ago ? 31 : 0
recency_bonus = usable_date > 12.hours.ago ? 80 : 0
today_bonus = usable_date > 26.hours.ago ? 395 : 0
two_day_bonus = usable_date > 48.hours.ago ? 330 : 0
FunctionCaller.new("blackbox-production-articleHotness",
{ article: article, user: article.user }.to_json).call +
reaction_points + recency_bonus + super_recent_bonus + super_super_recent_bonus + today_bonus + two_day_bonus