FIX: Ignored flags should not count in your accuracy score

FIX: Ignored flags should not count in your accuracy score

diff --git a/app/models/reviewable_score.rb b/app/models/reviewable_score.rb
index 14ba16e..823e893 100644
--- a/app/models/reviewable_score.rb
+++ b/app/models/reviewable_score.rb
@@ -59,19 +59,14 @@ class ReviewableScore < ActiveRecord::Base
     user_stat = user&.user_stat
     return 0.0 if user_stat.blank?
 
-    calc_user_accuracy_bonus(
-      user_stat.flags_agreed,
-      user_stat.flags_disagreed,
-      user_stat.flags_ignored
-    )
+    calc_user_accuracy_bonus(user_stat.flags_agreed, user_stat.flags_disagreed)
   end
 
-  def self.calc_user_accuracy_bonus(agreed, disagreed, ignored)
+  def self.calc_user_accuracy_bonus(agreed, disagreed)
     agreed ||= 0
     disagreed ||= 0
-    ignored ||= 0
 
-    total = (agreed + disagreed + ignored).to_f
+    total = (agreed + disagreed).to_f
     return 0.0 if total <= 5
 
     (agreed / total) * 5.0
diff --git a/app/serializers/reviewable_score_explanation_serializer.rb b/app/serializers/reviewable_score_explanation_serializer.rb
index caff0ce..73dccc0 100644
--- a/app/serializers/reviewable_score_explanation_serializer.rb
+++ b/app/serializers/reviewable_score_explanation_serializer.rb
@@ -14,11 +14,7 @@ class ReviewableScoreExplanationSerializer < ApplicationSerializer
   )
 
   def user_accuracy_bonus
-    ReviewableScore.calc_user_accuracy_bonus(
-      object.flags_agreed,
-      object.flags_disagreed,
-      object.flags_ignored
-    )
+    ReviewableScore.calc_user_accuracy_bonus(object.flags_agreed, object.flags_disagreed)
   end
 
 end
diff --git a/spec/models/reviewable_score_spec.rb b/spec/models/reviewable_score_spec.rb
index 6a1c409..abf717e 100644
--- a/spec/models/reviewable_score_spec.rb
+++ b/spec/models/reviewable_score_spec.rb
@@ -107,10 +107,11 @@ RSpec.describe ReviewableScore, type: :model do
       user_stat.flags_disagreed = 2
       expect(ReviewableScore.user_accuracy_bonus(user).floor(2)).to eq(3.33)
 
+      # Ignored flags don't count
       user_stat.flags_agreed = 121
       user_stat.flags_disagreed = 44
       user_stat.flags_ignored = 4
-      expect(ReviewableScore.user_accuracy_bonus(user).floor(2)).to eq(3.57)
+      expect(ReviewableScore.user_accuracy_bonus(user).floor(2)).to eq(3.66)
     end
 
   end
@@ -137,7 +138,7 @@ RSpec.describe ReviewableScore, type: :model do
         user_stat.flags_agreed = 12
         user_stat.flags_disagreed = 2
         user_stat.flags_ignored = 2
-        expect(ReviewableScore.user_flag_score(user)).to eq(6.75)
+        expect(ReviewableScore.user_flag_score(user).floor(2)).to eq(7.28)
       end
     end
   end

GitHub sha: 5bf3a003

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: