mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Change logic on analyze page to include admin data when presenting insufficiency messages and enable/disable academic year checkboxes
This commit is contained in:
parent
42e150b33b
commit
a4dbeb6718
3 changed files with 11 additions and 5 deletions
|
|
@ -42,7 +42,7 @@ module AnalyzeHelper
|
|||
@empty_dataset ||= Hash.new do |memo, (school, academic_year)|
|
||||
memo[[school, academic_year]] = measures.none? do |measure|
|
||||
response_rate = measure.subcategory.response_rate(school:, academic_year:)
|
||||
response_rate.meets_student_threshold || response_rate.meets_teacher_threshold
|
||||
response_rate.meets_student_threshold || response_rate.meets_teacher_threshold || measure.sufficient_admin_data?(school:, academic_year:)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ class Measure < ActiveRecord::Base
|
|||
@ideal_low_benchmark ||= benchmark(:ideal_low_benchmark)
|
||||
end
|
||||
|
||||
def sufficient_admin_data?(school:, academic_year:)
|
||||
any_admin_data_collected?(school:, academic_year:)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def any_admin_data_collected?(school:, academic_year:)
|
||||
|
|
@ -157,7 +161,7 @@ class Measure < ActiveRecord::Base
|
|||
def collect_admin_scale_average(admin_data_items:, school:, academic_year:)
|
||||
@collect_admin_scale_average ||= Hash.new do |memo, (admin_data_items, school, academic_year)|
|
||||
memo[[admin_data_items, school, academic_year]] = begin
|
||||
admin_values = AdminDataValue.where(school:, academic_year:)
|
||||
admin_values = AdminDataValue.where(school:, academic_year:, admin_data_item: admin_data_items)
|
||||
admin_values.map do |admin_value|
|
||||
admin_value.likert_score if admin_value.present?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ module Analyze
|
|||
end
|
||||
|
||||
def show_irrelevancy_message?
|
||||
!measure.includes_teacher_survey_items? && !measure.includes_student_survey_items?
|
||||
false
|
||||
end
|
||||
|
||||
def show_insufficient_data_message?
|
||||
|
|
@ -52,7 +52,9 @@ module Analyze
|
|||
measure.score(school:, academic_year: year)
|
||||
end
|
||||
|
||||
scores.all? { |score| !score.meets_teacher_threshold? && !score.meets_student_threshold? }
|
||||
scores.all? do |score|
|
||||
!score.meets_teacher_threshold? && !score.meets_student_threshold? && !score.meets_admin_data_threshold?
|
||||
end
|
||||
end
|
||||
|
||||
def column_midpoint
|
||||
|
|
@ -109,7 +111,7 @@ module Analyze
|
|||
YearlyScore = Struct.new(:year, :score)
|
||||
def yearly_scores
|
||||
yearly_scores = academic_years.each_with_index.map do |year, index|
|
||||
YearlyScore.new(year, score(index))
|
||||
YearlyScore.new(year, score(index))
|
||||
end
|
||||
yearly_scores.reject do |yearly_score|
|
||||
yearly_score.score.blank?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue