From f36b86922897a840056d0c8b05ae13fc98973d0d Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Wed, 27 Feb 2019 07:41:52 -0800 Subject: [PATCH] Adjust article ranking algorithm to use crossposted_at where available (#1917) --- app/black_box/black_box.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/black_box/black_box.rb b/app/black_box/black_box.rb index 61d27307f..39b43a3a8 100644 --- a/app/black_box/black_box.rb +++ b/app/black_box/black_box.rb @@ -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