sqm-dashboards/app/presenters/analyze/graph/column/all_data.rb
rebuilt e38bdfb761 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:17:02 -07:00

42 lines
1.1 KiB
Ruby

module Analyze
module Graph
module Column
class AllData
def label
%w[All Data]
end
def show_irrelevancy_message?(measure:)
false
end
def show_insufficient_data_message?(measure:, school:, academic_years:)
scores = academic_years.map do |year|
measure.score(school:, academic_year: year)
end
scores.none? do |score|
score.meets_teacher_threshold? || score.meets_student_threshold? || score.meets_admin_data_threshold?
end
end
def score(measure:, school:, academic_year:)
measure.score(school:, academic_year:) || 0
end
def type
:all_data
end
def basis
"student surveys"
end
def n_size(measure:, school:, academic_year:)
SurveyItemResponse.where(survey_item: measure.student_survey_items, school:, grade: grades,
academic_year:).select(:response_id).distinct.count
end
end
end
end
end