mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
Faster admin data loader + rename School.school_hash
This commit is contained in:
parent
0965841566
commit
b3e6efdb2e
7 changed files with 128 additions and 77 deletions
|
|
@ -8,7 +8,7 @@ class School < ApplicationRecord
|
|||
validates :name, presence: true
|
||||
|
||||
scope :alphabetic, -> { order(name: :asc) }
|
||||
scope :school_hash, -> { all.map { |school| [school.dese_id, school] }.to_h }
|
||||
scope :school_by_dese_id, -> { all.map { |school| [school.dese_id, school] }.to_h }
|
||||
|
||||
include FriendlyId
|
||||
friendly_id :name, use: [:slugged]
|
||||
|
|
@ -16,7 +16,7 @@ class School < ApplicationRecord
|
|||
def self.find_by_district_code_and_school_code(district_code, school_code)
|
||||
School
|
||||
.joins(:district)
|
||||
.where(districts: { qualtrics_code: district_code })
|
||||
.where(districts: {qualtrics_code: district_code})
|
||||
.find_by_qualtrics_code(school_code)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue