chore: prevent multiple lookups for the boston district by inlining the

sql
mciea-main
Nelson Jovel 2 years ago
parent db7c74479d
commit 9e368ae47d

@ -16,8 +16,7 @@ class SurveyItemResponse < ActiveRecord::Base
has_one :measure, through: :survey_item
scope :exclude_boston, lambda {
boston = District.find_by_name("Boston")
where.not(school: boston.schools) if boston.present?
includes(school: :district).where.not("district.name": "Boston")
}
scope :averages_for_grade, lambda { |survey_items, school, academic_year, grade|

Loading…
Cancel
Save