mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 12:42:57 +08:00
5af7c90bab
We found score hard to understand. It is still there behind the scenes for sorting purposes, but it is no longer shown. You can now filter by minimum priority (low, med, high) instead of score.
16 lines
480 B
Ruby
16 lines
480 B
Ruby
class Jobs::ReviewablePriorities < Jobs::Scheduled
|
|
every 1.day
|
|
|
|
def execute(args)
|
|
|
|
# We calculate the percentiles here for medium and high. Low is always 0 (all)
|
|
res = DB.query_single(<<~SQL)
|
|
SELECT COALESCE(PERCENTILE_DISC(0.4) WITHIN GROUP (ORDER BY score), 0.0) AS medium,
|
|
COALESCE(PERCENTILE_DISC(0.8) WITHIN GROUP (ORDER BY score), 0.0) AS high
|
|
FROM reviewables
|
|
SQL
|
|
|
|
Reviewable.set_priorities(medium: res[0], high: res[1])
|
|
end
|
|
end
|