rename admin data to school data

rpp-main
rebuilt 3 years ago
parent 25f839e728
commit 1595c3a58c

@ -7,7 +7,7 @@ class AdminDataPresenter < DataItemPresenter
end end
def title def title
'School admin data' "School data"
end end
def id def id
@ -15,13 +15,13 @@ class AdminDataPresenter < DataItemPresenter
end end
def reason_for_insufficiency def reason_for_insufficiency
'limited availability' "limited availability"
end end
def descriptions_and_availability def descriptions_and_availability
@admin_data_items.map do |admin_data_item| @admin_data_items.map do |admin_data_item|
DataAvailability.new(admin_data_item.admin_data_item_id, admin_data_item.description, DataAvailability.new(admin_data_item.admin_data_item_id, admin_data_item.description,
admin_data_item.admin_data_values.where(school:, academic_year:).count > 0) admin_data_item.admin_data_values.where(school:, academic_year:).count > 0)
end end
end end
end end

@ -5,11 +5,11 @@ module Analyze
module Column module Column
class AllAdmin < GroupedBarColumnPresenter class AllAdmin < GroupedBarColumnPresenter
def label def label
'All Admin' "School data"
end end
def basis def basis
'admin data' "school data"
end end
def show_irrelevancy_message? def show_irrelevancy_message?
@ -23,7 +23,7 @@ module Analyze
end end
def insufficiency_message def insufficiency_message
['data not', 'available'] ["data not", "available"]
end end
def score(year_index) def score(year_index)

@ -59,7 +59,7 @@ class VarianceChartRowPresenter
[].tap do |sources| [].tap do |sources|
sources << 'teacher survey results' if @measure.includes_teacher_survey_items? && !@meets_teacher_threshold 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 << 'student survey results' if @measure.includes_student_survey_items? && !@meets_student_threshold
sources << 'administrative data' if @measure.includes_admin_data_items? sources << 'school data' if @measure.includes_admin_data_items?
end end
end end

@ -8,7 +8,7 @@
<div class="modal-body"> <div class="modal-body">
<p>Were unable to display results for the selected school and school year due to: </p> <p>Were unable to display results for the selected school and school year due to: </p>
<ul> <ul>
<li>Limited availability of school admin data</li> <li>Limited availability of school data</li>
<li> Teacher and student survey response rates below 25% </li> <li> Teacher and student survey response rates below 25% </li>
</ul> </ul>
<p> You may continue to explore the structure of the HALS School Quality Measures Framework, but we recommend selecting a different school and/or a different school year for the best experience.</p> <p> You may continue to explore the structure of the HALS School Quality Measures Framework, but we recommend selecting a different school and/or a different school year for the best experience.</p>

@ -4,16 +4,16 @@
<% if displayed_presenters.none? %> <% if displayed_presenters.none? %>
<p class="caption mb-5">Note: No measures can be displayed due to limited availability of school admin data and/or low survey response rates.</p> <p class="caption mb-5">Note: No measures can be displayed due to limited availability of school admin data and/or low survey response rates.</p>
<% elsif not_displayed_presenters.present? %> <% elsif not_displayed_presenters.present? %>
<p class="caption mb-5">Note: The following measures are not displayed due to limited availability of school admin data and/or low survey response rates: <%= not_displayed_presenters.map(&:measure_name).join('; ') %>.</p> <p class="caption mb-5">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('; ') %>.</p>
<% end %> <% end %>
<svg width="100%" height=<%= graph_height(displayed_presenters.size) %> xmlns="http://www.w3.org/2000/svg"> <svg width="100%" height=<%= graph_height(displayed_presenters.size) %> xmlns="http://www.w3.org/2000/svg">
<filter id="inset-shadow" x="-50%" y="-50%" width="200%" height="200%"> <filter id="inset-shadow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in=SourceAlpha> <feComponentTransfer in=SourceAlpha>
<feFuncA type="table" tableValues="1 0"/> <feFuncA type="table" tableValues="1 0" />
</feComponentTransfer> </feComponentTransfer>
<feGaussianBlur stdDeviation="4"/> <feGaussianBlur stdDeviation="4" />
<feOffset dx="0" dy="0" result="offsetblur"/> <feOffset dx="0" dy="0" result="offsetblur"/>
<feFlood flood-color="rgb(62, 58, 56, 0.25)" result="color"/> <feFlood flood-color="rgb(62, 58, 56, 0.25)" result="color"/>
<feComposite in2="offsetblur" operator="in"/> <feComposite in2="offsetblur" operator="in"/>

@ -1,9 +1,9 @@
require 'rails_helper' require "rails_helper"
describe MeasurePresenter do describe MeasurePresenter do
let(:academic_year) { create(:academic_year, range: '1989-90') } let(:academic_year) { create(:academic_year, range: "1989-90") }
let(:school) { create(:school, name: 'Best School') } let(:school) { create(:school, name: "Best School") }
let(:measure) { create(:measure, measure_id: 'measure-id') } let(:measure) { create(:measure, measure_id: "measure-id") }
let(:teacher_scale) { create(:teacher_scale, measure:) } let(:teacher_scale) { create(:teacher_scale, measure:) }
let(:student_scale) { create(:student_scale, measure:) } let(:student_scale) { create(:student_scale, measure:) }
let(:admin_scale) { create(:scale, measure:) } let(:admin_scale) { create(:scale, measure:) }
@ -13,103 +13,103 @@ describe MeasurePresenter do
create(:survey, school:, academic_year:) create(:survey, school:, academic_year:)
end end
it 'returns the id of the measure' do it "returns the id of the measure" do
expect(measure_presenter.id).to eq 'measure-id' expect(measure_presenter.id).to eq "measure-id"
end end
it 'has an id for use in the data item accordions' do it "has an id for use in the data item accordions" do
expect(measure_presenter.data_item_accordion_id).to eq 'data-item-accordion-measure-id' expect(measure_presenter.data_item_accordion_id).to eq "data-item-accordion-measure-id"
end end
context 'when the measure contains only teacher data' do context "when the measure contains only teacher data" do
before :each do before :each do
survey_item1 = create(:teacher_survey_item, scale: teacher_scale, prompt: 'A teacher survey item prompt') survey_item1 = create(:teacher_survey_item, scale: teacher_scale, prompt: "A teacher survey item prompt")
survey_item2 = create(:teacher_survey_item, scale: teacher_scale, prompt: 'Another teacher survey item prompt') survey_item2 = create(:teacher_survey_item, scale: teacher_scale, prompt: "Another teacher survey item prompt")
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD, survey_item: survey_item1, create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD, survey_item: survey_item1,
academic_year:, school:, likert_score: 1) academic_year:, school:, likert_score: 1)
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD, survey_item: survey_item2, create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD, survey_item: survey_item2,
academic_year:, school:, likert_score: 5) academic_year:, school:, likert_score: 5)
end end
it 'creates a gauge presenter that presents the average likert score' do it "creates a gauge presenter that presents the average likert score" do
expect(measure_presenter.gauge_presenter.title).to eq 'Growth' expect(measure_presenter.gauge_presenter.title).to eq "Growth"
end end
it 'returns a list of data item presenters that has only one element, and that element has a title of "Teacher survey"' do it 'returns a list of data item presenters that has only one element, and that element has a title of "Teacher survey"' do
expect(measure_presenter.data_item_presenters.count).to eq 1 expect(measure_presenter.data_item_presenters.count).to eq 1
expect(measure_presenter.data_item_presenters.first.id).to eq 'teacher-survey-items-measure-id' expect(measure_presenter.data_item_presenters.first.id).to eq "teacher-survey-items-measure-id"
expect(measure_presenter.data_item_presenters.first.title).to eq 'Teacher survey' expect(measure_presenter.data_item_presenters.first.title).to eq "Teacher survey"
expect(measure_presenter.data_item_presenters.first.data_item_accordion_id).to eq 'data-item-accordion-measure-id' expect(measure_presenter.data_item_presenters.first.data_item_accordion_id).to eq "data-item-accordion-measure-id"
end end
end end
context 'when the measure contains both teacher data and admin data' do context "when the measure contains both teacher data and admin data" do
before :each do before :each do
create(:teacher_survey_item, scale: teacher_scale, prompt: 'A teacher survey item prompt') create(:teacher_survey_item, scale: teacher_scale, prompt: "A teacher survey item prompt")
create(:teacher_survey_item, scale: teacher_scale, prompt: 'Another teacher survey item prompt') create(:teacher_survey_item, scale: teacher_scale, prompt: "Another teacher survey item prompt")
create(:admin_data_item, scale: admin_scale, description: 'An admin data item description') create(:admin_data_item, scale: admin_scale, description: "An admin data item description")
create(:admin_data_item, scale: admin_scale, description: 'Another admin data item description') create(:admin_data_item, scale: admin_scale, description: "Another admin data item description")
end end
it 'returns a list of data item presenters with two elements' do it "returns a list of data item presenters with two elements" do
expect(measure_presenter.data_item_presenters.count).to eq 2 expect(measure_presenter.data_item_presenters.count).to eq 2
first_data_item_presenter = measure_presenter.data_item_presenters[0] first_data_item_presenter = measure_presenter.data_item_presenters[0]
expect(first_data_item_presenter.id).to eq 'teacher-survey-items-measure-id' expect(first_data_item_presenter.id).to eq "teacher-survey-items-measure-id"
expect(first_data_item_presenter.title).to eq 'Teacher survey' expect(first_data_item_presenter.title).to eq "Teacher survey"
expect(first_data_item_presenter.data_item_accordion_id).to eq 'data-item-accordion-measure-id' expect(first_data_item_presenter.data_item_accordion_id).to eq "data-item-accordion-measure-id"
second_data_item_presenter = measure_presenter.data_item_presenters[1] second_data_item_presenter = measure_presenter.data_item_presenters[1]
expect(second_data_item_presenter.id).to eq 'admin-data-items-measure-id' expect(second_data_item_presenter.id).to eq "admin-data-items-measure-id"
expect(second_data_item_presenter.title).to eq 'School admin data' expect(second_data_item_presenter.title).to eq "School data"
expect(second_data_item_presenter.data_item_accordion_id).to eq 'data-item-accordion-measure-id' expect(second_data_item_presenter.data_item_accordion_id).to eq "data-item-accordion-measure-id"
end end
end end
context 'when the measure has partial data for teachers and students' do context "when the measure has partial data for teachers and students" do
before :each do before :each do
teacher_survey_item = create(:teacher_survey_item, scale: teacher_scale) teacher_survey_item = create(:teacher_survey_item, scale: teacher_scale)
student_survey_item = create(:student_survey_item, scale: student_scale) student_survey_item = create(:student_survey_item, scale: student_scale)
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD, create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD,
survey_item: teacher_survey_item, academic_year:, school:) survey_item: teacher_survey_item, academic_year:, school:)
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD - 1, create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD - 1,
survey_item: student_survey_item, academic_year:, school:) survey_item: student_survey_item, academic_year:, school:)
end end
it 'tracks which parts of the data are sufficient' do it "tracks which parts of the data are sufficient" do
teacher_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter| teacher_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
presenter.title == 'Teacher survey' presenter.title == "Teacher survey"
end end
student_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter| student_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
presenter.title == 'Student survey' presenter.title == "Student survey"
end end
expect(teacher_data_item_presenter.sufficient_data?).to be true expect(teacher_data_item_presenter.sufficient_data?).to be true
expect(student_data_item_presenter.sufficient_data?).to be false expect(student_data_item_presenter.sufficient_data?).to be false
end end
end end
context 'when the measure has insufficient admin data and insufficient teacher/student data' do context "when the measure has insufficient admin data and insufficient teacher/student data" do
before :each do before :each do
create(:admin_data_item, scale: admin_scale) create(:admin_data_item, scale: admin_scale)
create(:teacher_survey_item, scale: teacher_scale) create(:teacher_survey_item, scale: teacher_scale)
create(:student_survey_item, scale: student_scale) create(:student_survey_item, scale: student_scale)
end end
it 'tracks the reason for their insufficiency' do it "tracks the reason for their insufficiency" do
teacher_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter| teacher_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
presenter.title == 'Teacher survey' presenter.title == "Teacher survey"
end end
student_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter| student_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
presenter.title == 'Student survey' presenter.title == "Student survey"
end end
admin_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter| admin_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
presenter.title == 'School admin data' presenter.title == "School data"
end end
expect(teacher_data_item_presenter.reason_for_insufficiency).to eq 'low response rate' expect(teacher_data_item_presenter.reason_for_insufficiency).to eq "low response rate"
expect(student_data_item_presenter.reason_for_insufficiency).to eq 'low response rate' expect(student_data_item_presenter.reason_for_insufficiency).to eq "low response rate"
expect(admin_data_item_presenter.reason_for_insufficiency).to eq 'limited availability' expect(admin_data_item_presenter.reason_for_insufficiency).to eq "limited availability"
end end
end end
end end

@ -1,4 +1,4 @@
require 'rails_helper' require "rails_helper"
describe VarianceChartRowPresenter do describe VarianceChartRowPresenter do
let(:watch_low_benchmark) { 2.9 } let(:watch_low_benchmark) { 2.9 }
@ -9,15 +9,15 @@ describe VarianceChartRowPresenter do
let(:measure) do let(:measure) do
measure = create( measure = create(
:measure, :measure,
name: 'Some Title' name: "Some Title"
) )
scale = create(:scale, measure:) scale = create(:scale, measure:)
create(:student_survey_item, scale:, create(:student_survey_item, scale:,
watch_low_benchmark:, watch_low_benchmark:,
growth_low_benchmark:, growth_low_benchmark:,
approval_low_benchmark:, approval_low_benchmark:,
ideal_low_benchmark:) ideal_low_benchmark:)
measure measure
end end
@ -25,7 +25,7 @@ describe VarianceChartRowPresenter do
let(:measure_without_admin_data_items) do let(:measure_without_admin_data_items) do
create( create(
:measure, :measure,
name: 'Some Title' name: "Some Title"
) )
end end
@ -33,216 +33,216 @@ describe VarianceChartRowPresenter do
VarianceChartRowPresenter.new measure:, score: VarianceChartRowPresenter.new measure:, score:
end end
shared_examples_for 'measure_name' do shared_examples_for "measure_name" do
it 'returns the measure name' do it "returns the measure name" do
expect(presenter.measure_name).to eq 'Some Title' expect(presenter.measure_name).to eq "Some Title"
end end
end end
context 'when the score is in the Ideal zone' do context "when the score is in the Ideal zone" do
let(:score) { Score.new(average: 4.4, meets_teacher_threshold: true, meets_student_threshold: true) } let(:score) { Score.new(average: 4.4, meets_teacher_threshold: true, meets_student_threshold: true) }
it_behaves_like 'measure_name' it_behaves_like "measure_name"
it 'returns the correct color' do it "returns the correct color" do
expect(presenter.bar_color).to eq 'fill-ideal' expect(presenter.bar_color).to eq "fill-ideal"
end end
it 'returns a bar width equal to the approval zone width plus the proportionate ideal zone width' do it "returns a bar width equal to the approval zone width plus the proportionate ideal zone width" do
expect(presenter.bar_width).to eq '30.0%' expect(presenter.bar_width).to eq "30.0%"
end end
it 'returns an x-offset of 60%' do it "returns an x-offset of 60%" do
expect(presenter.x_offset).to eq '60%' expect(presenter.x_offset).to eq "60%"
end end
end end
context 'when the score is in the Approval zone' do context "when the score is in the Approval zone" do
let(:score) { Score.new(average: 3.7, meets_teacher_threshold: true, meets_student_threshold: true) } let(:score) { Score.new(average: 3.7, meets_teacher_threshold: true, meets_student_threshold: true) }
it_behaves_like 'measure_name' it_behaves_like "measure_name"
it 'returns the correct color' do it "returns the correct color" do
expect(presenter.bar_color).to eq 'fill-approval' expect(presenter.bar_color).to eq "fill-approval"
end end
it 'returns a bar width equal to the proportionate approval zone width' do it "returns a bar width equal to the proportionate approval zone width" do
expect(presenter.bar_width).to eq '10.0%' expect(presenter.bar_width).to eq "10.0%"
end end
it 'returns an x-offset of 60%' do it "returns an x-offset of 60%" do
expect(presenter.x_offset).to eq '60%' expect(presenter.x_offset).to eq "60%"
end end
end end
context 'when the score is in the Growth zone' do context "when the score is in the Growth zone" do
let(:score) { Score.new(average: 3.2, meets_teacher_threshold: true, meets_student_threshold: true) } let(:score) { Score.new(average: 3.2, meets_teacher_threshold: true, meets_student_threshold: true) }
it_behaves_like 'measure_name' it_behaves_like "measure_name"
it 'returns the correct color' do it "returns the correct color" do
expect(presenter.bar_color).to eq 'fill-growth' expect(presenter.bar_color).to eq "fill-growth"
end end
it 'returns a bar width equal to the proportionate growth zone width' do it "returns a bar width equal to the proportionate growth zone width" do
expect(presenter.bar_width).to eq '16.0%' expect(presenter.bar_width).to eq "16.0%"
end end
context 'in order to achieve the visual effect' do context "in order to achieve the visual effect" do
it 'returns an x-offset equal to 60% minus the bar width' do it "returns an x-offset equal to 60% minus the bar width" do
expect(presenter.x_offset).to eq '44.0%' expect(presenter.x_offset).to eq "44.0%"
end end
end end
end end
context 'when the score is in the Watch zone' do context "when the score is in the Watch zone" do
let(:score) { Score.new(average: 2.9, meets_teacher_threshold: true, meets_student_threshold: true) } let(:score) { Score.new(average: 2.9, meets_teacher_threshold: true, meets_student_threshold: true) }
it_behaves_like 'measure_name' it_behaves_like "measure_name"
it 'returns the correct color' do it "returns the correct color" do
expect(presenter.bar_color).to eq 'fill-watch' expect(presenter.bar_color).to eq "fill-watch"
end end
it 'returns a bar width equal to the proportionate watch zone width plus the growth zone width' do it "returns a bar width equal to the proportionate watch zone width plus the growth zone width" do
expect(presenter.bar_width).to eq '40.0%' expect(presenter.bar_width).to eq "40.0%"
end end
context 'in order to achieve the visual effect' do context "in order to achieve the visual effect" do
it 'returns an x-offset equal to 60% minus the bar width' do it "returns an x-offset equal to 60% minus the bar width" do
expect(presenter.x_offset).to eq '20.0%' expect(presenter.x_offset).to eq "20.0%"
end end
end end
end end
context 'when the score is in the Warning zone' do context "when the score is in the Warning zone" do
let(:score) { Score.new(average: 1.0, meets_teacher_threshold: true, meets_student_threshold: true) } let(:score) { Score.new(average: 1.0, meets_teacher_threshold: true, meets_student_threshold: true) }
it_behaves_like 'measure_name' it_behaves_like "measure_name"
it 'returns the correct color' do it "returns the correct color" do
expect(presenter.bar_color).to eq 'fill-warning' expect(presenter.bar_color).to eq "fill-warning"
end end
it 'returns a bar width equal to the proportionate warning zone width plus the watch & growth zone widths' do it "returns a bar width equal to the proportionate warning zone width plus the watch & growth zone widths" do
expect(presenter.bar_width).to eq '60.0%' expect(presenter.bar_width).to eq "60.0%"
end end
context 'in order to achieve the visual effect' do context "in order to achieve the visual effect" do
it 'returns an x-offset equal to 60% minus the bar width' do it "returns an x-offset equal to 60% minus the bar width" do
expect(presenter.x_offset).to eq '0.0%' expect(presenter.x_offset).to eq "0.0%"
end end
end end
end end
context 'when a measure does not contain admin data items' do context "when a measure does not contain admin data items" do
let(:score) { Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: false) } let(:score) { Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: false) }
it 'it does not show a partial data indicator' do it "it does not show a partial data indicator" do
presenter_without_admin_data = VarianceChartRowPresenter.new measure: measure_without_admin_data_items, presenter_without_admin_data = VarianceChartRowPresenter.new measure: measure_without_admin_data_items,
score: score score: score
expect(presenter_without_admin_data.show_partial_data_indicator?).to be false expect(presenter_without_admin_data.show_partial_data_indicator?).to be false
end end
end end
context 'when a measure contains admin data items' do context "when a measure contains admin data items" do
before :each do before :each do
end end
let(:score) { Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: false) } let(:score) { Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: false) }
it 'shows a partial data indicator' do it "shows a partial data indicator" do
measure_with_admin_data = create( measure_with_admin_data = create(
:measure, :measure,
name: 'Some Title' name: "Some Title"
) )
scale_with_admin_data = create(:scale, measure: measure_with_admin_data) scale_with_admin_data = create(:scale, measure: measure_with_admin_data)
create :admin_data_item, create :admin_data_item,
scale: scale_with_admin_data, scale: scale_with_admin_data,
watch_low_benchmark: watch_low_benchmark, watch_low_benchmark: watch_low_benchmark,
growth_low_benchmark: growth_low_benchmark, growth_low_benchmark: growth_low_benchmark,
approval_low_benchmark: approval_low_benchmark, approval_low_benchmark: approval_low_benchmark,
ideal_low_benchmark: ideal_low_benchmark ideal_low_benchmark: ideal_low_benchmark
admin_data_presenter = VarianceChartRowPresenter.new measure: measure_with_admin_data, admin_data_presenter = VarianceChartRowPresenter.new measure: measure_with_admin_data,
score: Score.new( score: Score.new(
average: 3.7, meets_teacher_threshold: true, meets_student_threshold: true average: 3.7, meets_teacher_threshold: true, meets_student_threshold: true
) )
expect(admin_data_presenter.show_partial_data_indicator?).to be true expect(admin_data_presenter.show_partial_data_indicator?).to be true
expect(admin_data_presenter.partial_data_sources).to eq ['administrative data'] expect(admin_data_presenter.partial_data_sources).to eq ["school data"]
end end
end end
context 'when a measure contains teacher survey items' do context "when a measure contains teacher survey items" do
before :each do before :each do
scale = create(:scale, measure:) scale = create(:scale, measure:)
create :teacher_survey_item, scale: create :teacher_survey_item, scale:
end end
context 'when there are insufficient teacher survey item responses' do context "when there are insufficient teacher survey item responses" do
let(:score) { Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: true) } let(:score) { Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: true) }
it 'shows a partial data indicator' do it "shows a partial data indicator" do
expect(presenter.show_partial_data_indicator?).to be true expect(presenter.show_partial_data_indicator?).to be true
expect(presenter.partial_data_sources).to eq ['teacher survey results'] expect(presenter.partial_data_sources).to eq ["teacher survey results"]
end end
end end
context 'when there are sufficient teacher survey item responses' do context "when there are sufficient teacher survey item responses" do
let(:score) { Score.new(average: nil, meets_teacher_threshold: true, meets_student_threshold: true) } let(:score) { Score.new(average: nil, meets_teacher_threshold: true, meets_student_threshold: true) }
it 'does not show a partial data indicator' do it "does not show a partial data indicator" do
expect(presenter.show_partial_data_indicator?).to be false expect(presenter.show_partial_data_indicator?).to be false
end end
end end
end end
context 'when a measure contains student survey items' do context "when a measure contains student survey items" do
before :each do before :each do
scale = create(:scale, measure:) scale = create(:scale, measure:)
create :student_survey_item, scale: create :student_survey_item, scale:
end end
context 'when there are insufficient student survey item responses' do context "when there are insufficient student survey item responses" do
let(:score) { Score.new(average: nil, meets_teacher_threshold: true, meets_student_threshold: false) } let(:score) { Score.new(average: nil, meets_teacher_threshold: true, meets_student_threshold: false) }
it 'shows a partial data indicator' do it "shows a partial data indicator" do
expect(presenter.show_partial_data_indicator?).to be true expect(presenter.show_partial_data_indicator?).to be true
expect(presenter.partial_data_sources).to eq ['student survey results'] expect(presenter.partial_data_sources).to eq ["student survey results"]
end end
context 'where there are also admin data items' do context "where there are also admin data items" do
before :each do before :each do
scale = create(:scale, measure:) scale = create(:scale, measure:)
create :admin_data_item, scale: create :admin_data_item, scale:
end end
it 'returns the sources for partial results of administrative data and student survey results' do it "returns the sources for partial results of administrative data and student survey results" do
expect(presenter.partial_data_sources).to eq ['student survey results', 'administrative data'] expect(presenter.partial_data_sources).to eq ["student survey results", "school data"]
end end
end end
end end
context 'When there are sufficient student survey item responses' do context "When there are sufficient student survey item responses" do
let(:score) { Score.new(average: nil, meets_teacher_threshold: true, meets_student_threshold: true) } let(:score) { Score.new(average: nil, meets_teacher_threshold: true, meets_student_threshold: true) }
it 'does not show a partial data indicator' do it "does not show a partial data indicator" do
expect(presenter.show_partial_data_indicator?).to be false expect(presenter.show_partial_data_indicator?).to be false
end end
end end
end end
context 'sorting scores' do context "sorting scores" do
it 'selects a longer bar before a shorter bar for measures in the approval/ideal zones' do it "selects a longer bar before a shorter bar for measures in the approval/ideal zones" do
scale_with_student_survey_items = create(:scale, measure:) scale_with_student_survey_items = create(:scale, measure:)
create(:student_survey_item, create(:student_survey_item,
scale: scale_with_student_survey_items, scale: scale_with_student_survey_items,
watch_low_benchmark:, watch_low_benchmark:,
growth_low_benchmark:, growth_low_benchmark:,
approval_low_benchmark:, approval_low_benchmark:,
ideal_low_benchmark:) ideal_low_benchmark:)
approval_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 3.7, meets_teacher_threshold: true,meets_student_threshold: true) approval_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 3.7, meets_teacher_threshold: true, meets_student_threshold: true)
ideal_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 4.4, meets_teacher_threshold: true, meets_student_threshold: true) ideal_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 4.4, meets_teacher_threshold: true, meets_student_threshold: true)
expect(ideal_presenter <=> approval_presenter).to be < 0 expect(ideal_presenter <=> approval_presenter).to be < 0
expect([approval_presenter, ideal_presenter].sort).to eq [ideal_presenter, approval_presenter] expect([approval_presenter, ideal_presenter].sort).to eq [ideal_presenter, approval_presenter]
end end
it 'selects a warning bar below a ideal bar' do it "selects a warning bar below a ideal bar" do
warning_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 1.0, meets_teacher_threshold: true, meets_student_threshold: true) warning_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 1.0, meets_teacher_threshold: true, meets_student_threshold: true)
ideal_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 5.0, meets_teacher_threshold: true, meets_student_threshold: true) ideal_presenter = VarianceChartRowPresenter.new measure: measure, score: Score.new(average: 5.0, meets_teacher_threshold: true, meets_student_threshold: true)
expect(warning_presenter <=> ideal_presenter).to be > 0 expect(warning_presenter <=> ideal_presenter).to be > 0

@ -1,42 +1,42 @@
require 'rails_helper' require "rails_helper"
include VarianceHelper include VarianceHelper
describe 'overview/index' do describe "overview/index" do
subject { Nokogiri::HTML(rendered) } subject { Nokogiri::HTML(rendered) }
let(:support_for_teaching) do let(:support_for_teaching) do
measure = create(:measure, name: 'Support For Teaching Development & Growth', measure_id: '1') measure = create(:measure, name: "Support For Teaching Development & Growth", measure_id: "1")
scale = create(:scale, measure:) scale = create(:scale, measure:)
create(:student_survey_item, create(:student_survey_item,
scale:, scale:,
watch_low_benchmark: 1.5, watch_low_benchmark: 1.5,
growth_low_benchmark: 2.5, growth_low_benchmark: 2.5,
approval_low_benchmark: 3.5, approval_low_benchmark: 3.5,
ideal_low_benchmark: 4.5) ideal_low_benchmark: 4.5)
measure measure
end end
let(:effective_leadership) do let(:effective_leadership) do
measure = create(:measure, name: 'Effective Leadership', measure_id: '2') measure = create(:measure, name: "Effective Leadership", measure_id: "2")
scale = create(:scale, measure:) scale = create(:scale, measure:)
create(:teacher_survey_item, create(:teacher_survey_item,
scale:, scale:,
watch_low_benchmark: 1.5, watch_low_benchmark: 1.5,
growth_low_benchmark: 2.5, growth_low_benchmark: 2.5,
approval_low_benchmark: 3.5, approval_low_benchmark: 3.5,
ideal_low_benchmark: 4.5) ideal_low_benchmark: 4.5)
measure measure
end end
let(:professional_qualifications) do let(:professional_qualifications) do
measure = create(:measure, name: 'Professional Qualifications', measure_id: '3') measure = create(:measure, name: "Professional Qualifications", measure_id: "3")
scale = create(:scale, measure:) scale = create(:scale, measure:)
create(:admin_data_item, create(:admin_data_item,
scale:, scale:,
watch_low_benchmark: 1.5, watch_low_benchmark: 1.5,
growth_low_benchmark: 2.5, growth_low_benchmark: 2.5,
approval_low_benchmark: 3.5, approval_low_benchmark: 3.5,
ideal_low_benchmark: 4.5) ideal_low_benchmark: 4.5)
measure measure
end end
@ -49,12 +49,12 @@ describe 'overview/index' do
@school = create(:school) @school = create(:school)
ResponseRate.create!(subcategory: Subcategory.first, school: @school, academic_year: @academic_year, ResponseRate.create!(subcategory: Subcategory.first, school: @school, academic_year: @academic_year,
student_response_rate: 100, teacher_response_rate: 100, meets_student_threshold: true, meets_teacher_threshold: true) student_response_rate: 100, teacher_response_rate: 100, meets_student_threshold: true, meets_teacher_threshold: true)
render render
end end
context 'when some presenters have a nil score' do context "when some presenters have a nil score" do
let(:variance_chart_row_presenters) do let(:variance_chart_row_presenters) do
[ [
VarianceChartRowPresenter.new(measure: support_for_teaching, score: Score.new), VarianceChartRowPresenter.new(measure: support_for_teaching, score: Score.new),
@ -63,49 +63,49 @@ describe 'overview/index' do
] ]
end end
it 'displays a note detailing which measures have insufficient responses for the given school & academic year' do it "displays a note detailing which measures have insufficient responses for the given school & academic year" do
expect(rendered).to match %r{Note: The following measures are not displayed due to limited availability of school admin data and/or low survey response rates: Support For Teaching Development &amp; Growth; Professional Qualifications.} expect(rendered).to match %r{Note: The following measures are not displayed due to limited availability of school data and/or low survey response rates: Support For Teaching Development &amp; Growth; Professional Qualifications.}
end end
it 'displays a variance row and label only those presenters for which the score is not nil' do it "displays a variance row and label only those presenters for which the score is not nil" do
displayed_variance_rows = subject.css('[data-for-measure-id]') displayed_variance_rows = subject.css("[data-for-measure-id]")
expect(displayed_variance_rows.count).to eq 1 expect(displayed_variance_rows.count).to eq 1
expect(displayed_variance_rows.first.attribute('data-for-measure-id').value).to eq '2' expect(displayed_variance_rows.first.attribute("data-for-measure-id").value).to eq "2"
displayed_variance_labels = subject.css('[data-variance-row-label]') displayed_variance_labels = subject.css("[data-variance-row-label]")
expect(displayed_variance_labels.count).to eq 1 expect(displayed_variance_labels.count).to eq 1
expect(displayed_variance_labels.first.inner_text).to include 'Effective Leadership' expect(displayed_variance_labels.first.inner_text).to include "Effective Leadership"
end end
end end
context 'when all the presenters have a non-nil score' do context "when all the presenters have a non-nil score" do
let(:variance_chart_row_presenters) do let(:variance_chart_row_presenters) do
measure = create(:measure, name: 'Display Me', measure_id: 'display-me') measure = create(:measure, name: "Display Me", measure_id: "display-me")
scale = create(:scale, measure:) scale = create(:scale, measure:)
create(:student_survey_item, create(:student_survey_item,
scale:, scale:,
watch_low_benchmark: 1.5, watch_low_benchmark: 1.5,
growth_low_benchmark: 2.5, growth_low_benchmark: 2.5,
approval_low_benchmark: 3.5, approval_low_benchmark: 3.5,
ideal_low_benchmark: 4.5) ideal_low_benchmark: 4.5)
[ [
VarianceChartRowPresenter.new(measure:, VarianceChartRowPresenter.new(measure:,
score: Score.new(average: rand)) score: Score.new(average: rand))
] ]
end end
it 'does not display a note detailing which measures have insufficient responses for the given school & academic year' do it "does not display a note detailing which measures have insufficient responses for the given school & academic year" do
expect(rendered).not_to match %r{Note: The following measures are not displayed due to limited availability of school admin data and/or low survey response rates} expect(rendered).not_to match %r{Note: The following measures are not displayed due to limited availability of school data and/or low survey response rates}
end end
it 'displays a variance row for each presenter' do it "displays a variance row for each presenter" do
displayed_variance_rows = subject.css('[data-for-measure-id]') displayed_variance_rows = subject.css("[data-for-measure-id]")
expect(displayed_variance_rows.count).to eq 1 expect(displayed_variance_rows.count).to eq 1
expect(displayed_variance_rows.first.attribute('data-for-measure-id').value).to eq 'display-me' expect(displayed_variance_rows.first.attribute("data-for-measure-id").value).to eq "display-me"
displayed_variance_labels = subject.css('[data-variance-row-label]') displayed_variance_labels = subject.css("[data-variance-row-label]")
expect(displayed_variance_labels.count).to eq 1 expect(displayed_variance_labels.count).to eq 1
expect(displayed_variance_labels.first.inner_text).to include 'Display Me' expect(displayed_variance_labels.first.inner_text).to include "Display Me"
end end
end end
end end

Loading…
Cancel
Save