a story needs (upvotes - downvotes) >= 2 to appear on the front page
This commit is contained in:
parent
59db77019b
commit
1f86ffd4fe
|
@ -11,6 +11,7 @@ class StoryRepository
|
||||||
|
|
||||||
def hottest
|
def hottest
|
||||||
hottest = positive_ranked base_scope
|
hottest = positive_ranked base_scope
|
||||||
|
hottest = has_minimal_score hottest
|
||||||
hottest = filter_hidden_and_tags hottest
|
hottest = filter_hidden_and_tags hottest
|
||||||
hottest.order('hotness')
|
hottest.order('hotness')
|
||||||
end
|
end
|
||||||
|
@ -121,6 +122,10 @@ private
|
||||||
scope.where("#{Story.score_sql} >= 0")
|
scope.where("#{Story.score_sql} >= 0")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_minimal_score(scope)
|
||||||
|
scope.where("#{Story.score_sql} >= 2")
|
||||||
|
end
|
||||||
|
|
||||||
def filter_tags(scope, tags)
|
def filter_tags(scope, tags)
|
||||||
scope.where(
|
scope.where(
|
||||||
Story.arel_table[:id].not_in(
|
Story.arel_table[:id].not_in(
|
||||||
|
|
Loading…
Reference in a new issue