From 2a7581ab8035f34752376824865f7c0adcf9283c Mon Sep 17 00:00:00 2001 From: Luke Baker Date: Wed, 17 Nov 2010 13:49:35 -0500 Subject: [PATCH] for losses test, ignore questions with votes prior to 2010-02-17 --- lib/tasks/test_api.rake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/tasks/test_api.rake b/lib/tasks/test_api.rake index 40145db..125b252 100644 --- a/lib/tasks/test_api.rake +++ b/lib/tasks/test_api.rake @@ -401,9 +401,14 @@ namespace :test_api do error_bool= true end - if (choice.losses != question.votes.count(:conditions => {:loser_choice_id => choice.id})) - error_message += "Error!: Cached choice losses != actual choice losses for choice #{choice.id}\n" - error_bool= true + # votes before 2010-02-17 have null loser_choice_id + # therefore we want to ignore this test for any question with votes + # prior to 2010-02-17 + if question.votes.count(:conditions => ["created_at < ?", '2010-02-17']) == 0 + if (choice.losses != question.votes.count(:conditions => {:loser_choice_id => choice.id})) + error_message += "Error!: Cached choice losses != actual choice losses for choice #{choice.id}\n" + error_bool= true + end end end -- libgit2 0.21.2