Commit 66785cf616175e1ce5a7e3d734a3f2d459cab0fb

Authored by Dhruv Kapadia
1 parent c8233782

Adding total appearances to prompt cache miss rate message

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
lib/tasks/test_api.rake
@@ -496,15 +496,15 @@ namespace :test_api do @@ -496,15 +496,15 @@ namespace :test_api do
496 496
497 question.expire_prompt_cache_tracking_keys(Date.yesterday) 497 question.expire_prompt_cache_tracking_keys(Date.yesterday)
498 498
499 - yesterday_votes = question.appearances.count(:conditions => ['date(created_at) = ?', Date.yesterday]) 499 + yesterday_appearances = question.appearances.count(:conditions => ['date(created_at) = ?', Date.yesterday])
500 500
501 - if misses + hits != yesterday_votes  
502 - error_message += "Error! Question #{question.id} isn't tracking prompt cache hits and misses accurately! Expected #{yesterday_votes}, Actual: #{misses+hits}\n" 501 + if misses + hits != yesterday_appearances
  502 + error_message += "Error! Question #{question.id} isn't tracking prompt cache hits and misses accurately! Expected #{yesterday_appearances}, Actual: #{misses+hits}\n"
503 end 503 end
504 504
505 - miss_rate = misses.to_f / yesterday_votes.to_f 505 + miss_rate = misses.to_f / yesterday_appearances.to_f
506 if miss_rate > 0.1 506 if miss_rate > 0.1
507 - error_message += "Error! Question #{question.id} has less than 90% of appearances taken from a pre-generated cache! Expected <#{0.1}, Actual: #{miss_rate}\n" 507 + error_message += "Error! Question #{question.id} has less than 90% of appearances taken from a pre-generated cache! Expected <#{0.1}, Actual: #{miss_rate}, total appearances yesterday: #{yesterday_appearances}\n"
508 end 508 end
509 return error_message.blank? ? [success_message, false] : [error_message, true] 509 return error_message.blank? ? [success_message, false] : [error_message, true]
510 end 510 end