mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FIX: Sensitivity did not work by default
Forums without previously calculated scores would return the same values for low/medium/high sensitivity. Now those are scaled based on the default value. The default value has also been changed from 10.0 to 12.5 based on observing data from live discourse forums.
This commit is contained in:
@ -78,6 +78,12 @@ class Reviewable < ActiveRecord::Base
|
||||
)
|
||||
end
|
||||
|
||||
# This number comes from looking at forums in the wild and what numbers work.
|
||||
# As the site accumulates real data it'll be based on the site activity instead.
|
||||
def self.typical_sensitivity
|
||||
12.5
|
||||
end
|
||||
|
||||
# Generate `pending?`, `rejected?`, etc helper methods
|
||||
statuses.each do |name, id|
|
||||
define_method("#{name}?") { status == id }
|
||||
@ -195,11 +201,13 @@ class Reviewable < ActiveRecord::Base
|
||||
return Float::MAX if sensitivity == 0
|
||||
|
||||
ratio = sensitivity / Reviewable.sensitivity[:low].to_f
|
||||
high = PluginStore.get('reviewables', "priority_#{Reviewable.priorities[:high]}")
|
||||
return (10.0 * scale) if high.nil?
|
||||
high = (
|
||||
PluginStore.get('reviewables', "priority_#{Reviewable.priorities[:high]}") ||
|
||||
typical_sensitivity
|
||||
).to_f
|
||||
|
||||
# We want this to be hard to reach
|
||||
(high.to_f * ratio) * scale
|
||||
((high.to_f * ratio) * scale).truncate(2)
|
||||
end
|
||||
|
||||
def self.sensitivity_score(sensitivity, scale: 1.0)
|
||||
|
Reference in New Issue
Block a user