From 7855b2c3c47332c58ddbede5dbcf23f579445e14 Mon Sep 17 00:00:00 2001 From: Carl Chenet Date: Tue, 23 May 2017 14:14:47 +0200 Subject: [PATCH] Story: move minimum score to a constant, like Comment has --- app/models/story.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/story.rb b/app/models/story.rb index f90c021..d390474 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -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