From 05f535ed5c9bd46ce7061445c02f6397a338826d Mon Sep 17 00:00:00 2001 From: rebuilt Date: Sun, 11 Jun 2023 14:40:33 -0700 Subject: [PATCH] perf: include survey items with measures to avoid n+1 queries when scoring by student/teacher survey items --- app/controllers/overview_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/overview_controller.rb b/app/controllers/overview_controller.rb index bbd84bc3..464944ab 100644 --- a/app/controllers/overview_controller.rb +++ b/app/controllers/overview_controller.rb @@ -8,9 +8,9 @@ class OverviewController < SqmApplicationController @variance_chart_row_presenters = measures.map(&method(:presenter_for_measure)) @category_presenters = Category.sorted.map { |category| CategoryPresenter.new(category:) } @student_response_rate_presenter = ResponseRatePresenter.new(focus: :student, school: @school, - academic_year: @academic_year) + academic_year: @academic_year) @teacher_response_rate_presenter = ResponseRatePresenter.new(focus: :teacher, school: @school, - academic_year: @academic_year) + academic_year: @academic_year) end private @@ -29,7 +29,7 @@ class OverviewController < SqmApplicationController end def measures - @measures ||= Measure.all.includes(%i[scales admin_data_items category subcategory]) + @measures ||= Measure.all.includes(%i[scales admin_data_items category subcategory survey_items]) end def subcategories