mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-11 00:10:35 -07:00
chore: fix code so I can run reports
This commit is contained in:
parent
3b20c27e4b
commit
fb001c0140
3 changed files with 32 additions and 9 deletions
|
|
@ -30,9 +30,10 @@ class Measure < ActiveRecord::Base
|
|||
.student_survey_items
|
||||
.where("survey_item_responses.school": school,
|
||||
"survey_item_responses.academic_year": academic_year,
|
||||
"survey_item_responses.survey_item_id": survey_items.student_survey_items)
|
||||
.group('survey_items.id')
|
||||
.having('count(*) >= 10')
|
||||
"survey_item_responses.survey_item_id": survey_items.student_survey_items,
|
||||
"survey_item_responses.grade": school.grades(academic_year:))
|
||||
.group("survey_items.id")
|
||||
.having("count(*) >= 10")
|
||||
.count.keys)
|
||||
end
|
||||
@student_survey_items_with_sufficient_responses[[school, academic_year]]
|
||||
|
|
@ -134,6 +135,27 @@ class Measure < ActiveRecord::Base
|
|||
averages.average
|
||||
end
|
||||
|
||||
def zone(school:, academic_year:)
|
||||
zone_for_score(score: score(school:, academic_year:))
|
||||
end
|
||||
|
||||
def student_zone(school:, academic_year:)
|
||||
zone_for_score(score: student_score(school:, academic_year:))
|
||||
end
|
||||
|
||||
def teacher_zone(school:, academic_year:)
|
||||
zone_for_score(score: teacher_score(school:, academic_year:))
|
||||
end
|
||||
|
||||
def admin_zone(school:, academic_year:)
|
||||
zone_for_score(score: admin_score(school:, academic_year:))
|
||||
end
|
||||
|
||||
def zone_for_score(score:)
|
||||
Zones.new(watch_low_benchmark:, growth_low_benchmark:,
|
||||
approval_low_benchmark:, ideal_low_benchmark:).zone_for_score(score.average)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def any_admin_data_collected?(school:, academic_year:)
|
||||
|
|
@ -201,3 +223,4 @@ class Measure < ActiveRecord::Base
|
|||
AdminDataValue.where(school:, academic_year:, admin_data_item: admin_data_items).pluck(:likert_score)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ module Report
|
|||
score = measure.score(school:, academic_year:)
|
||||
zone = measure.zone(school:, academic_year:).type.to_s.capitalize
|
||||
|
||||
begin_date = SurveyItemResponse.where(school:,
|
||||
academic_year:).where.not(recorded_date: nil).order(:recorded_date).first&.recorded_date&.to_date
|
||||
end_date = SurveyItemResponse.where(school:,
|
||||
academic_year:).where.not(recorded_date: nil).order(:recorded_date).last&.recorded_date&.to_date
|
||||
begin_date = ::SurveyItemResponse.where(school:,
|
||||
academic_year:).where.not(recorded_date: nil).order(:recorded_date).first&.recorded_date&.to_date
|
||||
end_date = ::SurveyItemResponse.where(school:,
|
||||
academic_year:).where.not(recorded_date: nil).order(:recorded_date).last&.recorded_date&.to_date
|
||||
date_range = "#{begin_date} - #{end_date}"
|
||||
|
||||
row = [response_rate, measure, school, academic_year]
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ module Report
|
|||
all_grades = all_grades.to_a
|
||||
grades = "#{all_grades.first}-#{all_grades.last}"
|
||||
|
||||
begin_date = SurveyItemResponse.where(school: district.schools,
|
||||
begin_date = ::SurveyItemResponse.where(school: district.schools,
|
||||
academic_year:).where.not(recorded_date: nil).order(:recorded_date).first&.recorded_date&.to_date
|
||||
end_date = SurveyItemResponse.where(school: district.schools,
|
||||
end_date = ::SurveyItemResponse.where(school: district.schools,
|
||||
academic_year:).where.not(recorded_date: nil).order(:recorded_date).last&.recorded_date&.to_date
|
||||
date_range = "#{begin_date} - #{end_date}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue