feat: Add parent button to overview page and alter 'School Quality Framework Indicators' section to show parent scales
parent
a9f952d21d
commit
dc7c466e58
@ -0,0 +1,24 @@
|
|||||||
|
class ParentResponseRatePresenter < ResponseRatePresenter
|
||||||
|
def initialize(academic_year:, school:)
|
||||||
|
super(academic_year:, school:)
|
||||||
|
@survey_items = SurveyItem.parent_survey_items
|
||||||
|
end
|
||||||
|
|
||||||
|
def actual_count
|
||||||
|
SurveyItemResponse.includes(:parent).where(school:, academic_year:).where.not(parent_id: nil)
|
||||||
|
.select(:parent_id)
|
||||||
|
.distinct
|
||||||
|
.map { |response| response.parent&.number_of_children }
|
||||||
|
.compact.sum
|
||||||
|
end
|
||||||
|
|
||||||
|
def respondents_count
|
||||||
|
return 0 if respondents.nil?
|
||||||
|
|
||||||
|
respondents.total_students
|
||||||
|
end
|
||||||
|
|
||||||
|
def focus
|
||||||
|
"parent"
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
class StudentResponseRatePresenter < ResponseRatePresenter
|
||||||
|
def initialize(academic_year:, school:)
|
||||||
|
super(academic_year:, school:)
|
||||||
|
@survey_items = Measure.all.flat_map do |measure|
|
||||||
|
measure.student_survey_items_with_sufficient_responses(school:, academic_year:)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def actual_count
|
||||||
|
# Early ed surveys are given in batches so they have to be counted separately because we have to account for the same student having a different response id per batch
|
||||||
|
non_early_ed_items = survey_items - SurveyItem.early_education_survey_items
|
||||||
|
non_early_ed_count = response_count_for_survey_items(survey_items: non_early_ed_items)
|
||||||
|
|
||||||
|
early_ed_items = SurveyItem.early_education_survey_items
|
||||||
|
early_ed_count = SurveyItemResponse.where(school:, academic_year:,
|
||||||
|
survey_item: early_ed_items)
|
||||||
|
.group(:survey_item)
|
||||||
|
.select(:response_id)
|
||||||
|
.distinct
|
||||||
|
.count
|
||||||
|
.reduce(0) do |largest, row|
|
||||||
|
count = row[1]
|
||||||
|
if count > largest
|
||||||
|
count
|
||||||
|
else
|
||||||
|
largest
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
non_early_ed_count + early_ed_count
|
||||||
|
end
|
||||||
|
|
||||||
|
def respondents_count
|
||||||
|
return 0 if respondents.nil?
|
||||||
|
|
||||||
|
enrollment
|
||||||
|
end
|
||||||
|
|
||||||
|
def focus
|
||||||
|
"student"
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
class TeacherResponseRatePresenter < ResponseRatePresenter
|
||||||
|
def initialize(academic_year:, school:)
|
||||||
|
super(academic_year:, school:)
|
||||||
|
@survey_items = SurveyItem.teacher_survey_items
|
||||||
|
end
|
||||||
|
|
||||||
|
def actual_count
|
||||||
|
response_count_for_survey_items(survey_items:)
|
||||||
|
end
|
||||||
|
|
||||||
|
def respondents_count
|
||||||
|
return 0 if respondents.nil?
|
||||||
|
|
||||||
|
respondents.total_teachers
|
||||||
|
end
|
||||||
|
|
||||||
|
def focus
|
||||||
|
"teacher"
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in new issue