Commit 2a7581ab8035f34752376824865f7c0adcf9283c
1 parent
6fbb8179
Exists in
master
and in
1 other branch
for losses test, ignore questions with votes prior to 2010-02-17
Showing
1 changed file
with
8 additions
and
3 deletions
Show diff stats
lib/tasks/test_api.rake
... | ... | @@ -401,9 +401,14 @@ namespace :test_api do |
401 | 401 | error_bool= true |
402 | 402 | end |
403 | 403 | |
404 | - if (choice.losses != question.votes.count(:conditions => {:loser_choice_id => choice.id})) | |
405 | - error_message += "Error!: Cached choice losses != actual choice losses for choice #{choice.id}\n" | |
406 | - error_bool= true | |
404 | + # votes before 2010-02-17 have null loser_choice_id | |
405 | + # therefore we want to ignore this test for any question with votes | |
406 | + # prior to 2010-02-17 | |
407 | + if question.votes.count(:conditions => ["created_at < ?", '2010-02-17']) == 0 | |
408 | + if (choice.losses != question.votes.count(:conditions => {:loser_choice_id => choice.id})) | |
409 | + error_message += "Error!: Cached choice losses != actual choice losses for choice #{choice.id}\n" | |
410 | + error_bool= true | |
411 | + end | |
407 | 412 | end |
408 | 413 | |
409 | 414 | end | ... | ... |