mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
chore: prevent multiple lookups for the boston district by inlining the
sql
This commit is contained in:
parent
b29e6a75ec
commit
7ba124ac91
2 changed files with 1 additions and 5 deletions
|
|
@ -15,10 +15,6 @@ class District < ApplicationRecord
|
|||
self.slug ||= name.parameterize
|
||||
end
|
||||
|
||||
def self.boston
|
||||
District.find_by_name("Boston")
|
||||
end
|
||||
|
||||
def short_name
|
||||
name.split(" ").first.downcase
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class SurveyItemResponse < ActiveRecord::Base
|
|||
has_one :measure, through: :survey_item
|
||||
|
||||
scope :exclude_boston, lambda {
|
||||
where.not(school: District.boston.schools) if District.boston.present?
|
||||
includes(school: :district).where.not("district.name": "Boston")
|
||||
}
|
||||
|
||||
scope :averages_for_grade, lambda { |survey_items, school, academic_year, grade|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue