FIX: Require a min amount of reviewables before calculating thresholds

On forums with very few flags you don't want to calculate averages
because they won't be very useful. Stick with the defaults until we hit
15 reviewables at least.
This commit is contained in:
Robin Ward
2019-09-19 13:42:50 -04:00
parent 3c6a5836c2
commit d5b52abf2f
2 changed files with 28 additions and 12 deletions

View File

@@ -3,7 +3,12 @@
class Jobs::ReviewablePriorities < Jobs::Scheduled
every 1.day
def self.min_reviewables
15
end
def execute(args)
return unless Reviewable.where('score > 0').count >= self.class.min_reviewables
# We calculate the percentiles here for medium and high. Low is always 0 (all)
res = DB.query_single(<<~SQL)