sqm-dashboards/app/presenters/analyze/graph/column/all_teacher.rb
rebuilt b9ba8abf73 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-11 12:56:41 -07:00

46 lines
1.1 KiB
Ruby

# frozen_string_literal: true
module Analyze
module Graph
module Column
class AllTeacher
def label
%w[All Teachers]
end
def basis
"teacher surveys"
end
def insufficiency_message
["survey response", "rate below 25%"]
end
def show_irrelevancy_message?(measure:)
!measure.includes_teacher_survey_items?
end
def show_insufficient_data_message?(measure:, school:, academic_years:)
scores = academic_years.map do |year|
measure.score(school:, academic_year: year)
end
scores.all? { |score| !score.meets_teacher_threshold? }
end
def score(measure:, school:, academic_year:)
measure.teacher_score(school:, academic_year:)
end
def type
:teacher
end
def n_size(measure:, school:, academic_year:)
SurveyItemResponse.where(survey_item: measure.teacher_survey_items, school:,
academic_year:).pluck(:response_id).uniq.count
end
end
end
end
end