Add reaction score to article hotness score

This commit is contained in:
Ben Halpern 2018-06-07 11:14:11 -04:00
commit ab4b4fba6e
3 changed files with 13 additions and 5 deletions

View file

@ -1,8 +1,9 @@
class BlackBox
def self.article_hotness_score(article)
return (article.featured_number|| 10000)/10000 unless Rails.env.production?
reaction_points = article.reactions.sum(:points)
FunctionCaller.new("blackbox-production-articleHotness",
{article: article, user: article.user}.to_json).call
{article: article, user: article.user}.to_json).call + reaction_points
end
def self.comment_quality_score(comment)

View file

@ -105,9 +105,9 @@ class Reaction < ApplicationRecord
def assign_points
base_points = if category == "vomit"
-25.0
-50.0
elsif category == "thumbsdown"
-5.0
-10.0
else
1.0
end

View file

@ -38,9 +38,16 @@
</div>
<% end %>
<% else %>
<% if @user.email_public && @user.employer_name.present? && @user.location.present? && @user.education.present? %>
<% if @user.email_public &&
@user.employer_name.present? &&
@user.location.present? &&
@user.education.present? &&
@user.education.size > 25 &&
@user.summary.to_s.size < 145
%>
<style>
.user-profile-header {min-height: 410px;}
.user-profile-header {min-height: 398px;}
</style>
<% end %>
<% if @user.email_public %>