a story needs (upvotes - downvotes) >= 2 to appear on the front page

This commit is contained in:
Carl Chenet 2018-10-18 23:12:30 +02:00
parent 59db77019b
commit 1f86ffd4fe
1 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,7 @@ class StoryRepository
def hottest
hottest = positive_ranked base_scope
hottest = has_minimal_score hottest
hottest = filter_hidden_and_tags hottest
hottest.order('hotness')
end
@ -121,6 +122,10 @@ private
scope.where("#{Story.score_sql} >= 0")
end
def has_minimal_score(scope)
scope.where("#{Story.score_sql} >= 2")
end
def filter_tags(scope, tags)
scope.where(
Story.arel_table[:id].not_in(