Commit 36dd01a46412ef2861d6c4d29cdeacd87b3478ab

Authored by Dhruv Kapadia
1 parent 68fb12eb

Fixing some engine yard pecularities in test rake task

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
lib/tasks/test_api.rake
@@ -63,10 +63,10 @@ namespace :test_api do @@ -63,10 +63,10 @@ namespace :test_api do
63 63
64 appearances_by_choice_id = wins_hash.merge(losses_hash) do |key, oldval, newval| oldval + newval end 64 appearances_by_choice_id = wins_hash.merge(losses_hash) do |key, oldval, newval| oldval + newval end
65 65
66 - sum = total_appearances = appearances_by_choice_id.values.inject(:+) 66 + sum = total_appearances = appearances_by_choice_id.values.inject(0) {|sum, x| sum +=x}
67 mean = average_appearances = total_appearances.to_f / appearances_by_choice_id.size.to_f 67 mean = average_appearances = total_appearances.to_f / appearances_by_choice_id.size.to_f
68 68
69 - if sum: 69 + if sum > 0:
70 stddev = Math.sqrt( appearances_by_choice_id.values.inject(0) { |sum, e| sum + (e - mean) ** 2 } / appearances_by_choice_id.size.to_f ) 70 stddev = Math.sqrt( appearances_by_choice_id.values.inject(0) { |sum, e| sum + (e - mean) ** 2 } / appearances_by_choice_id.size.to_f )
71 71
72 appearances_by_choice_id.each do |choice_id, n_i| 72 appearances_by_choice_id.each do |choice_id, n_i|