Story: move minimum score to a constant, like Comment has

This commit is contained in:
Carl Chenet 2017-05-23 14:14:47 +02:00
parent 653d8e64a9
commit 7855b2c3c4

View file

@ -33,6 +33,9 @@ class Story < ActiveRecord::Base
DOWNVOTABLE_DAYS = 14
# the lowest a score can go
DOWNVOTABLE_MIN_SCORE = -5
# after this many minutes old, a story cannot be edited
MAX_EDIT_MINS = (60 * 6)
@ -381,7 +384,7 @@ class Story < ActiveRecord::Base
end
def is_downvotable?
if self.created_at && self.score >= -5
if self.created_at && self.score >= DOWNVOTABLE_MIN_SCORE
Time.now - self.created_at <= DOWNVOTABLE_DAYS.days
else
false