From eb4f79b6227ee8cadff8749aed6ad34dbe6fedcf Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 27 Jul 2023 17:51:42 -0400 Subject: [PATCH] optimize sql --- app/controllers/home_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index b2be0d91d..c87b39236 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -38,7 +38,7 @@ def lookup_most_recent_cases end # map to objects - most_recent_cases = Case.includes(:tries).where(id: [ case_ids ]) + most_recent_cases = Case.includes([:scorer,:scores]).where(id: [ case_ids ]) most_recent_cases = most_recent_cases.select { |kase| !kase.last_score.blank? } most_recent_cases = most_recent_cases.sort_by { |x| x.case_name } most_recent_cases