feat: ECP-126 Add measure and scale level graphs for parents by language

WIP: refactor so multiple graphs can be defined for a given slug

WIP: fixed scale view but broke 'All Parent' graph

WIP: working state.  All views working properly

WIP: Refactor graph_map into two collections; measure_level_graphs and scale_level_graphs

WIP: refacter GroupedBarColumnPresenter to accept a 'construct' instead of specifying measure or scale

WIP: fix scale graphs being shown on incorrect view

WIP: Merge parents_by_language class with parents_by_language_by_scale so it can handle display of both measure-level and scale-level graphs
This commit is contained in:
rebuilt 2025-05-06 14:14:47 -07:00
parent 7380d56064
commit 513445dc74
30 changed files with 333 additions and 249 deletions

View file

@ -18,11 +18,11 @@ module Analyze
"student surveys"
end
def show_irrelevancy_message?(measure:)
def show_irrelevancy_message?(construct:)
false
end
def show_insufficient_data_message?(measure:, school:, academic_years:)
def show_insufficient_data_message?(construct:, school:, academic_years:)
false
end
@ -30,18 +30,18 @@ module Analyze
:student
end
def n_size(measure:, school:, academic_year:)
SurveyItemResponse.where(grade:, survey_item: measure.student_survey_items, school:,
def n_size(construct:, school:, academic_year:)
SurveyItemResponse.where(grade:, survey_item: construct.student_survey_items, school:,
academic_year:).select(:response_id).distinct.count
end
def score(measure:, school:, academic_year:)
meets_student_threshold = sufficient_student_responses?(measure:, school:, academic_year:)
def score(construct:, school:, academic_year:)
meets_student_threshold = sufficient_student_responses?(construct:, school:, academic_year:)
return Score::NIL_SCORE unless meets_student_threshold
averages = SurveyItemResponse.averages_for_grade(measure.student_survey_items, school,
averages = SurveyItemResponse.averages_for_grade(construct.student_survey_items, school,
academic_year, grade)
average = bubble_up_averages(measure:, averages:).round(2)
average = bubble_up_averages(construct:, averages:).round(2)
Score.new(average:,
meets_teacher_threshold: false,
@ -49,11 +49,11 @@ module Analyze
meets_admin_data_threshold: false)
end
def sufficient_student_responses?(measure:, school:, academic_year:)
return false unless measure.subcategory.response_rate(school:, academic_year:).meets_student_threshold?
def sufficient_student_responses?(construct:, school:, academic_year:)
return false unless construct.subcategory.response_rate(school:, academic_year:).meets_student_threshold?
yearly_counts = SurveyItemResponse.where(school:, academic_year:,
survey_item: measure.student_survey_items).group(:grade).select(:response_id).distinct(:response_id).count
survey_item: construct.student_survey_items).group(:grade).select(:response_id).distinct(:response_id).count
yearly_counts.any? do |count|
count[1] >= 10
end