mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-13 09:20:38 -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
|
|
@ -21,6 +21,6 @@ class School < ApplicationRecord
|
|||
end
|
||||
|
||||
def grades(academic_year:)
|
||||
@grades ||= Respondent.find_by(school: self, academic_year:)&.enrollment_by_grade&.keys || (-1..12).to_a
|
||||
@grades ||= Respondent.by_school_and_year(school: self, academic_year:)&.enrollment_by_grade&.keys || (-1..12).to_a
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue