From 181859c6757c0571378177ba0e2cbdffff02092e Mon Sep 17 00:00:00 2001 From: Luke Baker Date: Tue, 17 Jan 2012 18:35:21 -0500 Subject: [PATCH] handle nil case for totals --- lib/tasks/test_api.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/test_api.rake b/lib/tasks/test_api.rake index bf0d784..bac88d9 100644 --- a/lib/tasks/test_api.rake +++ b/lib/tasks/test_api.rake @@ -244,7 +244,7 @@ namespace :test_api do SUM(wins) AS total_wins, SUM(losses) AS total_losses FROM choices WHERE question_id = #{question.id}") - if (totals["total"] % 2 != 0) + if (!totals["total"].blank? && totals["total"] % 2 != 0) error_message = "Error: Total votes is not Even!" end return error_message.blank? ? [success_message, false] : [error_message, true] -- libgit2 0.21.2