mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
perf: reduce number of queries for respondents
This commit is contained in:
parent
54ea72898d
commit
8fb0a280ca
6 changed files with 24 additions and 16 deletions
|
|
@ -142,7 +142,7 @@ module Analyze
|
|||
end
|
||||
|
||||
def grades(year_index)
|
||||
Respondent.find_by(school:, academic_year: academic_years[year_index]).enrollment_by_grade.keys
|
||||
Respondent.by_school_and_year(school:, academic_year: academic_years[year_index]).enrollment_by_grade.keys
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class ResponseRatePresenter
|
|||
end
|
||||
|
||||
def respondents
|
||||
Respondent.find_by(school:, academic_year:)
|
||||
@respondents ||= Respondent.by_school_and_year(school:, academic_year:)
|
||||
end
|
||||
|
||||
def grades
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue