sqm-dashboards/app/presenters/analyze/graph/column/all_student.rb
rebuilt 9911a75dc8 Refactor GroupedBarColumnPresenter to accept a configuration so that a
column can by given on the fly (dependency injection). Show Parent
graphs on analyze page.
2025-03-20 13:11:08 -07:00

47 lines
1.2 KiB
Ruby

# frozen_string_literal: true
module Analyze
module Graph
module Column
class AllStudent
def label
["All", "Students"]
end
def basis
"student surveys"
end
def insufficiency_message
["survey response", "rate below 25%"]
end
def show_irrelevancy_message?(measure:)
!measure.includes_student_survey_items?
end
def show_insufficient_data_message?(measure:, school:, academic_years:)
scores = academic_years.map do |academic_year|
measure.student_score(school:, academic_year:)
end
scores.none? { |score| score.meets_student_threshold? }
end
def score(measure:, school:, academic_year:)
measure.student_score(school:, academic_year:)
end
def type
:student
end
def n_size(measure:, school:, academic_year:)
grades = Respondent.by_school_and_year(school:, academic_year:)&.enrollment_by_grade&.keys
SurveyItemResponse.where(survey_item: measure.student_survey_items, school:, grade: grades,
academic_year:).select(:response_id).distinct.count
end
end
end
end
end