mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
feat: add special education disaggregation
This commit is contained in:
parent
a9b4f97a84
commit
acfdaf5587
23 changed files with 379 additions and 52 deletions
7
app/models/sped.rb
Normal file
7
app/models/sped.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class Sped < ApplicationRecord
|
||||
scope :by_designation, -> { all.map { |sped| [sped.designation, sped] }.to_h }
|
||||
|
||||
include FriendlyId
|
||||
|
||||
friendly_id :designation, use: [:slugged]
|
||||
end
|
||||
|
|
@ -11,6 +11,7 @@ class SurveyItemResponse < ActiveRecord::Base
|
|||
belongs_to :gender
|
||||
belongs_to :income
|
||||
belongs_to :ell
|
||||
belongs_to :sped
|
||||
|
||||
has_one :measure, through: :survey_item
|
||||
|
||||
|
|
@ -39,6 +40,11 @@ class SurveyItemResponse < ActiveRecord::Base
|
|||
academic_year:, ell:, grade: school.grades(academic_year:)).group(:survey_item).having("count(*) >= 10").average(:likert_score)
|
||||
}
|
||||
|
||||
scope :averages_for_sped, lambda { |survey_items, school, academic_year, sped|
|
||||
SurveyItemResponse.where(survey_item: survey_items, school:,
|
||||
academic_year:, sped:, grade: school.grades(academic_year:)).group(:survey_item).having("count(*) >= 10").average(:likert_score)
|
||||
}
|
||||
|
||||
scope :averages_for_race, lambda { |school, academic_year, race|
|
||||
SurveyItemResponse.joins("JOIN student_races on survey_item_responses.student_id = student_races.student_id JOIN students on students.id = student_races.student_id").where(
|
||||
school:, academic_year:, grade: school.grades(academic_year:)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue