Commit 810b711436cd5069f5a167ee860208c312b0071c
1 parent
b4aa8e60
Exists in
master
and in
1 other branch
update test to count invalid appearances
Showing
2 changed files
with
7 additions
and
1 deletions
Show diff stats
app/models/appearance.rb
lib/tasks/test_api.rake
... | ... | @@ -381,7 +381,7 @@ namespace :test_api do |
381 | 381 | |
382 | 382 | question.expire_prompt_cache_tracking_keys(yesterday) |
383 | 383 | |
384 | - yesterday_appearances = question.appearances.count(:conditions => ['created_at >= ? AND created_at < ?', Time.now.utc.yesterday.midnight, Time.now.utc.midnight]) | |
384 | + yesterday_appearances = Appearance.count_with_exclusive_scope(:conditions => ['created_at >= ? AND created_at < ? AND question_id = ?', Time.now.utc.yesterday.midnight, Time.now.utc.midnight, question.id]) | |
385 | 385 | |
386 | 386 | if misses + hits != yesterday_appearances |
387 | 387 | error_message += "Error! Question #{question.id} isn't tracking prompt cache hits and misses accurately! Expected #{yesterday_appearances}, Actual: #{misses+hits}, Hits: #{hits}, Misses: #{misses}\n" | ... | ... |