Commit 51357fdd3ad9c254e403fef46768c4179483d66b
1 parent
1a096cc0
Exists in
master
and in
1 other branch
update appearances test to only alert for active choices
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
lib/tasks/test_api.rake
@@ -504,7 +504,7 @@ namespace :test_api do | @@ -504,7 +504,7 @@ namespace :test_api do | ||
504 | stddev = Math.sqrt( appearances_by_choice_id.values.inject(0) { |sum, e| sum + (e - mean) ** 2 } / appearances_by_choice_id.size.to_f ) | 504 | stddev = Math.sqrt( appearances_by_choice_id.values.inject(0) { |sum, e| sum + (e - mean) ** 2 } / appearances_by_choice_id.size.to_f ) |
505 | 505 | ||
506 | appearances_by_choice_id.each do |choice_id, n_i| | 506 | appearances_by_choice_id.each do |choice_id, n_i| |
507 | - if (n_i < (mean - 6*stddev)) || (n_i > mean + 6 *stddev) | 507 | + if ((n_i < (mean - 6*stddev)) || (n_i > mean + 6 *stddev)) && Choice.find(choice_id).active? |
508 | error_message += "Choice #{choice_id} in Question ##{question.id} has an irregular number of appearances: #{n_i}, as compared to the mean: #{mean} and stddev #{stddev} for this question\n" | 508 | error_message += "Choice #{choice_id} in Question ##{question.id} has an irregular number of appearances: #{n_i}, as compared to the mean: #{mean} and stddev #{stddev} for this question\n" |
509 | end | 509 | end |
510 | end | 510 | end |