Commit 9235d495161db424fb9235e3a334dec9d45c8187

Authored by Luke Baker
1 parent 61d13234

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 557 if sum > 0:
558 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 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 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 564 end
564 565 end
... ...