Commit 9235d495161db424fb9235e3a334dec9d45c8187
1 parent
61d13234
Exists in
master
and in
1 other branch
ignore some choices for irregular # of appearances
choices that are deactivated / activated may appear to have irregular # of appearances. add an array to contain list of choices_ids that we will ignore for this test.
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
lib/tasks/test_api.rake
@@ -557,8 +557,9 @@ namespace :test_api do | @@ -557,8 +557,9 @@ namespace :test_api do | ||
557 | if sum > 0: | 557 | if sum > 0: |
558 | stddev = Math.sqrt( appearances_by_choice_id.values.inject(0) { |sum, e| sum + (e - mean) ** 2 } / appearances_by_choice_id.size.to_f ) | 558 | stddev = Math.sqrt( appearances_by_choice_id.values.inject(0) { |sum, e| sum + (e - mean) ** 2 } / appearances_by_choice_id.size.to_f ) |
559 | 559 | ||
560 | + ignore_choices = [133189] | ||
560 | appearances_by_choice_id.each do |choice_id, n_i| | 561 | appearances_by_choice_id.each do |choice_id, n_i| |
561 | - if ((n_i < (mean - 6*stddev)) || (n_i > mean + 6 *stddev)) && Choice.find(choice_id).active? | 562 | + if ((n_i < (mean - 6*stddev)) || (n_i > mean + 6 *stddev)) && !ignore_choices.include?(choice_id) && Choice.find(choice_id).active? |
562 | 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" | 563 | 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" |
563 | end | 564 | end |
564 | end | 565 | end |