mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Exclude boston results. Completes #182117456
This commit is contained in:
parent
4634282572
commit
57bfaa51c6
10 changed files with 65 additions and 5 deletions
|
|
@ -19,7 +19,8 @@ class StudentResponseRate
|
|||
def response_count
|
||||
@response_count ||= @subcategory.measures.map do |measure|
|
||||
measure.student_survey_items.map do |survey_item|
|
||||
survey_item.survey_item_responses.where(school: @school, academic_year: @academic_year).count
|
||||
survey_item.survey_item_responses.where(school: @school,
|
||||
academic_year: @academic_year).exclude_boston.count
|
||||
end.sum
|
||||
end.sum
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ class SurveyItem < ActiveRecord::Base
|
|||
|
||||
def score(school:, academic_year:)
|
||||
@score ||= Hash.new do |memo|
|
||||
memo[[school, academic_year]] = survey_item_responses.where(school:, academic_year:).average(:likert_score).to_f
|
||||
memo[[school, academic_year]] = survey_item_responses.where(school:,
|
||||
academic_year:).exclude_boston.average(:likert_score).to_f
|
||||
end
|
||||
|
||||
@score[[school, academic_year]]
|
||||
|
|
|
|||
|
|
@ -5,4 +5,9 @@ class SurveyItemResponse < ActiveRecord::Base
|
|||
belongs_to :academic_year
|
||||
belongs_to :school
|
||||
belongs_to :survey_item
|
||||
|
||||
scope :exclude_boston, lambda {
|
||||
boston = District.where(name: 'Boston').first
|
||||
where.not(school: boston.schools) if boston.present?
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class TeacherResponseRate
|
|||
def response_count
|
||||
@response_count ||= @subcategory.measures.map do |measure|
|
||||
measure.teacher_survey_items.map do |survey_item|
|
||||
survey_item.survey_item_responses.where(school: @school, academic_year: @academic_year).count
|
||||
survey_item.survey_item_responses.where(school: @school,
|
||||
academic_year: @academic_year).exclude_boston.count
|
||||
end.sum
|
||||
end.sum
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue