Commit 181859c6757c0571378177ba0e2cbdffff02092e

Authored by Luke Baker
1 parent fcb21580

handle nil case for totals

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
lib/tasks/test_api.rake
@@ -244,7 +244,7 @@ namespace :test_api do @@ -244,7 +244,7 @@ namespace :test_api do
244 SUM(wins) AS total_wins, 244 SUM(wins) AS total_wins,
245 SUM(losses) AS total_losses FROM choices 245 SUM(losses) AS total_losses FROM choices
246 WHERE question_id = #{question.id}") 246 WHERE question_id = #{question.id}")
247 - if (totals["total"] % 2 != 0) 247 + if (!totals["total"].blank? && totals["total"] % 2 != 0)
248 error_message = "Error: Total votes is not Even!" 248 error_message = "Error: Total votes is not Even!"
249 end 249 end
250 return error_message.blank? ? [success_message, false] : [error_message, true] 250 return error_message.blank? ? [success_message, false] : [error_message, true]