diff --git a/app/models/measure.rb b/app/models/measure.rb
index d48f3da3..72a794b4 100644
--- a/app/models/measure.rb
+++ b/app/models/measure.rb
@@ -173,6 +173,10 @@ class Measure < ActiveRecord::Base
approval_low_benchmark:, ideal_low_benchmark:).zone_for_score(score.average)
end
+ def construct_id
+ measure_id
+ end
+
private
def any_admin_data_collected?(school:, academic_year:)
diff --git a/app/models/scale.rb b/app/models/scale.rb
index bb2bc2d9..b53a68cc 100644
--- a/app/models/scale.rb
+++ b/app/models/scale.rb
@@ -42,6 +42,38 @@ class Scale < ApplicationRecord
where("scale_id LIKE 'p-%'")
}
+ def watch_low_benchmark
+ survey_items.first.watch_low_benchmark
+ end
+
+ def growth_low_benchmark
+ survey_items.first.growth_low_benchmark
+ end
+
+ def approval_low_benchmark
+ survey_items.first.approval_low_benchmark
+ end
+
+ def ideal_low_benchmark
+ survey_items.first.ideal_low_benchmark
+ end
+
+ def includes_teacher_survey_items?
+ survey_items.teacher_survey_items.length.positive?
+ end
+
+ def includes_student_survey_items?
+ survey_items.student_survey_items.length.positive?
+ end
+
+ def includes_admin_data_items?
+ admin_data_items.length.positive?
+ end
+
+ def construct_id
+ scale_id
+ end
+
private
def collect_survey_item_average(survey_items, school, academic_year)
diff --git a/app/presenters/overview/overview_presenter.rb b/app/presenters/overview/overview_presenter.rb
index 31ca5cf6..94fae8b9 100644
--- a/app/presenters/overview/overview_presenter.rb
+++ b/app/presenters/overview/overview_presenter.rb
@@ -46,7 +46,7 @@ class Overview::OverviewPresenter
def presenter_for_measure(measure)
score = measure.score(school: @school, academic_year: @academic_year)
- Overview::VarianceChartRowPresenter.new(measure:, score:)
+ Overview::VarianceChartRowPresenter.new(construct: measure, score:)
end
def empty_dataset?
diff --git a/app/presenters/overview/parent_overview_presenter.rb b/app/presenters/overview/parent_overview_presenter.rb
index bfd68aba..46dfa898 100644
--- a/app/presenters/overview/parent_overview_presenter.rb
+++ b/app/presenters/overview/parent_overview_presenter.rb
@@ -12,4 +12,21 @@ class Overview::ParentOverviewPresenter < Overview::OverviewPresenter
def framework_indicator_class
"school-quality-frameworks-parent"
end
+
+ def variance_chart_row_presenters
+ scales.map(&method(:presenter_for_scale))
+ end
+
+ def scales
+ measures.flat_map { |measure| measure.scales.parent_scales }
+ end
+
+ private
+
+ def presenter_for_scale(scale)
+ score = scale.parent_score(school: @school, academic_year: @academic_year)
+ score = Score.new(average: score, meets_teacher_threshold: true, meets_student_threshold: true)
+
+ Overview::VarianceChartRowPresenter.new(construct: scale, score:)
+ end
end
diff --git a/app/presenters/overview/variance_chart_row_presenter.rb b/app/presenters/overview/variance_chart_row_presenter.rb
index b8a5db6d..9147da2c 100644
--- a/app/presenters/overview/variance_chart_row_presenter.rb
+++ b/app/presenters/overview/variance_chart_row_presenter.rb
@@ -3,16 +3,16 @@
class Overview::VarianceChartRowPresenter
include Comparable
- attr_reader :score, :measure_name, :measure_id, :category
+ attr_reader :score, :construct_name, :construct_id, :category
- def initialize(measure:, score:)
- @measure = measure
+ def initialize(construct:, score:)
+ @construct = construct
@score = score.average
@meets_teacher_threshold = score.meets_teacher_threshold?
@meets_student_threshold = score.meets_student_threshold?
- @measure_name = @measure.name
- @measure_id = @measure.measure_id
- @category = @measure.subcategory.category
+ @construct_name = @construct.name
+ @construct_id = @construct.construct_id
+ @category = @construct.category
end
def sufficient_data?
@@ -57,9 +57,9 @@ class Overview::VarianceChartRowPresenter
def partial_data_sources
[].tap do |sources|
- sources << "teacher survey results" if @measure.includes_teacher_survey_items? && !@meets_teacher_threshold
- sources << "student survey results" if @measure.includes_student_survey_items? && !@meets_student_threshold
- sources << "administrative data" if @measure.includes_admin_data_items?
+ sources << "teacher survey results" if @construct.includes_teacher_survey_items? && !@meets_teacher_threshold
+ sources << "student survey results" if @construct.includes_student_survey_items? && !@meets_student_threshold
+ sources << "administrative data" if @construct.includes_admin_data_items?
end
end
@@ -106,10 +106,10 @@ class Overview::VarianceChartRowPresenter
def zone
zones = Zones.new(
- watch_low_benchmark: @measure.watch_low_benchmark,
- growth_low_benchmark: @measure.growth_low_benchmark,
- approval_low_benchmark: @measure.approval_low_benchmark,
- ideal_low_benchmark: @measure.ideal_low_benchmark
+ watch_low_benchmark: @construct.watch_low_benchmark,
+ growth_low_benchmark: @construct.growth_low_benchmark,
+ approval_low_benchmark: @construct.approval_low_benchmark,
+ ideal_low_benchmark: @construct.ideal_low_benchmark
)
zones.zone_for_score(@score)
end
diff --git a/app/views/overview/_variance_chart.html.erb b/app/views/overview/_variance_chart.html.erb
index 2479c48e..65308db6 100644
--- a/app/views/overview/_variance_chart.html.erb
+++ b/app/views/overview/_variance_chart.html.erb
@@ -4,7 +4,7 @@
<% if displayed_presenters.none? %>
Note: No measures can be displayed due to limited availability of school data and/or low survey response rates.
<% elsif not_displayed_presenters.present? %>
-
Note: The following measures are not displayed due to limited availability of school data and/or low survey response rates: <%= not_displayed_presenters.map(&:measure_name).join('; ') %>.
+
Note: The following measures are not displayed due to limited availability of school data and/or low survey response rates: <%= not_displayed_presenters.map(&:construct_name).join('; ') %>.