mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Merge branch 'rpp-rename-admin-data' into rpp-main to rename the admin
data to school data
This commit is contained in:
commit
c6651551b8
8 changed files with 194 additions and 194 deletions
|
|
@ -7,7 +7,7 @@ class AdminDataPresenter < DataItemPresenter
|
|||
end
|
||||
|
||||
def title
|
||||
'School admin data'
|
||||
"School data"
|
||||
end
|
||||
|
||||
def id
|
||||
|
|
@ -15,13 +15,13 @@ class AdminDataPresenter < DataItemPresenter
|
|||
end
|
||||
|
||||
def reason_for_insufficiency
|
||||
'limited availability'
|
||||
"limited availability"
|
||||
end
|
||||
|
||||
def descriptions_and_availability
|
||||
@admin_data_items.map do |admin_data_item|
|
||||
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
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ module Analyze
|
|||
module Column
|
||||
class AllAdmin < GroupedBarColumnPresenter
|
||||
def label
|
||||
'All Admin'
|
||||
"School data"
|
||||
end
|
||||
|
||||
def basis
|
||||
'admin data'
|
||||
"school data"
|
||||
end
|
||||
|
||||
def show_irrelevancy_message?
|
||||
|
|
@ -23,7 +23,7 @@ module Analyze
|
|||
end
|
||||
|
||||
def insufficiency_message
|
||||
['data not', 'available']
|
||||
["data not", "available"]
|
||||
end
|
||||
|
||||
def score(year_index)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class VarianceChartRowPresenter
|
|||
[].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 << 'school data' if @measure.includes_admin_data_items?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<div class="modal-body">
|
||||
<p>We’re unable to display results for the selected school and school year due to: </p>
|
||||
<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>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
<% 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>
|
||||
<% 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 %>
|
||||
|
||||
<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%">
|
||||
<feComponentTransfer in=SourceAlpha>
|
||||
<feFuncA type="table" tableValues="1 0"/>
|
||||
<feFuncA type="table" tableValues="1 0" />
|
||||
</feComponentTransfer>
|
||||
<feGaussianBlur stdDeviation="4"/>
|
||||
<feGaussianBlur stdDeviation="4" />
|
||||
<feOffset dx="0" dy="0" result="offsetblur"/>
|
||||
<feFlood flood-color="rgb(62, 58, 56, 0.25)" result="color"/>
|
||||
<feComposite in2="offsetblur" operator="in"/>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe MeasurePresenter do
|
||||
let(:academic_year) { create(:academic_year, range: '1989-90') }
|
||||
let(:school) { create(:school, name: 'Best School') }
|
||||
let(:measure) { create(:measure, measure_id: 'measure-id') }
|
||||
let(:academic_year) { create(:academic_year, range: "1989-90") }
|
||||
let(:school) { create(:school, name: "Best School") }
|
||||
let(:measure) { create(:measure, measure_id: "measure-id") }
|
||||
let(:teacher_scale) { create(:teacher_scale, measure:) }
|
||||
let(:student_scale) { create(:student_scale, measure:) }
|
||||
let(:admin_scale) { create(:scale, measure:) }
|
||||
|
|
@ -13,103 +13,103 @@ describe MeasurePresenter do
|
|||
create(:survey, school:, academic_year:)
|
||||
end
|
||||
|
||||
it 'returns the id of the measure' do
|
||||
expect(measure_presenter.id).to eq 'measure-id'
|
||||
it "returns the id of the measure" do
|
||||
expect(measure_presenter.id).to eq "measure-id"
|
||||
end
|
||||
|
||||
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'
|
||||
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"
|
||||
end
|
||||
|
||||
context 'when the measure contains only teacher data' do
|
||||
context "when the measure contains only teacher data" do
|
||||
before :each do
|
||||
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_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")
|
||||
|
||||
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,
|
||||
academic_year:, school:, likert_score: 5)
|
||||
academic_year:, school:, likert_score: 5)
|
||||
end
|
||||
|
||||
it 'creates a gauge presenter that presents the average likert score' do
|
||||
expect(measure_presenter.gauge_presenter.title).to eq 'Growth'
|
||||
it "creates a gauge presenter that presents the average likert score" do
|
||||
expect(measure_presenter.gauge_presenter.title).to eq "Growth"
|
||||
end
|
||||
|
||||
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.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.data_item_accordion_id).to eq 'data-item-accordion-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.data_item_accordion_id).to eq "data-item-accordion-measure-id"
|
||||
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
|
||||
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(: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(: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(: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")
|
||||
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
|
||||
|
||||
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.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.id).to eq "teacher-survey-items-measure-id"
|
||||
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"
|
||||
|
||||
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.title).to eq 'School admin data'
|
||||
expect(second_data_item_presenter.data_item_accordion_id).to eq 'data-item-accordion-measure-id'
|
||||
expect(second_data_item_presenter.id).to eq "admin-data-items-measure-id"
|
||||
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"
|
||||
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
|
||||
teacher_survey_item = create(:teacher_survey_item, scale: teacher_scale)
|
||||
student_survey_item = create(:student_survey_item, scale: student_scale)
|
||||
|
||||
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,
|
||||
survey_item: student_survey_item, academic_year:, school:)
|
||||
survey_item: student_survey_item, academic_year:, school:)
|
||||
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|
|
||||
presenter.title == 'Teacher survey'
|
||||
presenter.title == "Teacher survey"
|
||||
end
|
||||
student_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
|
||||
presenter.title == 'Student survey'
|
||||
presenter.title == "Student survey"
|
||||
end
|
||||
expect(teacher_data_item_presenter.sufficient_data?).to be true
|
||||
expect(student_data_item_presenter.sufficient_data?).to be false
|
||||
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
|
||||
create(:admin_data_item, scale: admin_scale)
|
||||
create(:teacher_survey_item, scale: teacher_scale)
|
||||
create(:student_survey_item, scale: student_scale)
|
||||
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|
|
||||
presenter.title == 'Teacher survey'
|
||||
presenter.title == "Teacher survey"
|
||||
end
|
||||
student_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
|
||||
presenter.title == 'Student survey'
|
||||
presenter.title == "Student survey"
|
||||
end
|
||||
admin_data_item_presenter = measure_presenter.data_item_presenters.find do |presenter|
|
||||
presenter.title == 'School admin data'
|
||||
presenter.title == "School data"
|
||||
end
|
||||
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(admin_data_item_presenter.reason_for_insufficiency).to eq 'limited availability'
|
||||
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(admin_data_item_presenter.reason_for_insufficiency).to eq "limited availability"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe VarianceChartRowPresenter do
|
||||
let(:watch_low_benchmark) { 2.9 }
|
||||
|
|
@ -9,15 +9,15 @@ describe VarianceChartRowPresenter do
|
|||
let(:measure) do
|
||||
measure = create(
|
||||
:measure,
|
||||
name: 'Some Title'
|
||||
name: "Some Title"
|
||||
)
|
||||
scale = create(:scale, measure:)
|
||||
|
||||
create(:student_survey_item, scale:,
|
||||
watch_low_benchmark:,
|
||||
growth_low_benchmark:,
|
||||
approval_low_benchmark:,
|
||||
ideal_low_benchmark:)
|
||||
watch_low_benchmark:,
|
||||
growth_low_benchmark:,
|
||||
approval_low_benchmark:,
|
||||
ideal_low_benchmark:)
|
||||
|
||||
measure
|
||||
end
|
||||
|
|
@ -25,7 +25,7 @@ describe VarianceChartRowPresenter do
|
|||
let(:measure_without_admin_data_items) do
|
||||
create(
|
||||
:measure,
|
||||
name: 'Some Title'
|
||||
name: "Some Title"
|
||||
)
|
||||
end
|
||||
|
||||
|
|
@ -33,216 +33,216 @@ describe VarianceChartRowPresenter do
|
|||
VarianceChartRowPresenter.new measure:, score:
|
||||
end
|
||||
|
||||
shared_examples_for 'measure_name' do
|
||||
it 'returns the measure name' do
|
||||
expect(presenter.measure_name).to eq 'Some Title'
|
||||
shared_examples_for "measure_name" do
|
||||
it "returns the measure name" do
|
||||
expect(presenter.measure_name).to eq "Some Title"
|
||||
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) }
|
||||
|
||||
it_behaves_like 'measure_name'
|
||||
it_behaves_like "measure_name"
|
||||
|
||||
it 'returns the correct color' do
|
||||
expect(presenter.bar_color).to eq 'fill-ideal'
|
||||
it "returns the correct color" do
|
||||
expect(presenter.bar_color).to eq "fill-ideal"
|
||||
end
|
||||
|
||||
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%'
|
||||
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%"
|
||||
end
|
||||
|
||||
it 'returns an x-offset of 60%' do
|
||||
expect(presenter.x_offset).to eq '60%'
|
||||
it "returns an x-offset of 60%" do
|
||||
expect(presenter.x_offset).to eq "60%"
|
||||
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) }
|
||||
|
||||
it_behaves_like 'measure_name'
|
||||
it_behaves_like "measure_name"
|
||||
|
||||
it 'returns the correct color' do
|
||||
expect(presenter.bar_color).to eq 'fill-approval'
|
||||
it "returns the correct color" do
|
||||
expect(presenter.bar_color).to eq "fill-approval"
|
||||
end
|
||||
|
||||
it 'returns a bar width equal to the proportionate approval zone width' do
|
||||
expect(presenter.bar_width).to eq '10.0%'
|
||||
it "returns a bar width equal to the proportionate approval zone width" do
|
||||
expect(presenter.bar_width).to eq "10.0%"
|
||||
end
|
||||
|
||||
it 'returns an x-offset of 60%' do
|
||||
expect(presenter.x_offset).to eq '60%'
|
||||
it "returns an x-offset of 60%" do
|
||||
expect(presenter.x_offset).to eq "60%"
|
||||
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) }
|
||||
|
||||
it_behaves_like 'measure_name'
|
||||
it_behaves_like "measure_name"
|
||||
|
||||
it 'returns the correct color' do
|
||||
expect(presenter.bar_color).to eq 'fill-growth'
|
||||
it "returns the correct color" do
|
||||
expect(presenter.bar_color).to eq "fill-growth"
|
||||
end
|
||||
|
||||
it 'returns a bar width equal to the proportionate growth zone width' do
|
||||
expect(presenter.bar_width).to eq '16.0%'
|
||||
it "returns a bar width equal to the proportionate growth zone width" do
|
||||
expect(presenter.bar_width).to eq "16.0%"
|
||||
end
|
||||
|
||||
context 'in order to achieve the visual effect' do
|
||||
it 'returns an x-offset equal to 60% minus the bar width' do
|
||||
expect(presenter.x_offset).to eq '44.0%'
|
||||
context "in order to achieve the visual effect" do
|
||||
it "returns an x-offset equal to 60% minus the bar width" do
|
||||
expect(presenter.x_offset).to eq "44.0%"
|
||||
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) }
|
||||
|
||||
it_behaves_like 'measure_name'
|
||||
it_behaves_like "measure_name"
|
||||
|
||||
it 'returns the correct color' do
|
||||
expect(presenter.bar_color).to eq 'fill-watch'
|
||||
it "returns the correct color" do
|
||||
expect(presenter.bar_color).to eq "fill-watch"
|
||||
end
|
||||
|
||||
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%'
|
||||
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%"
|
||||
end
|
||||
|
||||
context 'in order to achieve the visual effect' do
|
||||
it 'returns an x-offset equal to 60% minus the bar width' do
|
||||
expect(presenter.x_offset).to eq '20.0%'
|
||||
context "in order to achieve the visual effect" do
|
||||
it "returns an x-offset equal to 60% minus the bar width" do
|
||||
expect(presenter.x_offset).to eq "20.0%"
|
||||
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) }
|
||||
|
||||
it_behaves_like 'measure_name'
|
||||
it_behaves_like "measure_name"
|
||||
|
||||
it 'returns the correct color' do
|
||||
expect(presenter.bar_color).to eq 'fill-warning'
|
||||
it "returns the correct color" do
|
||||
expect(presenter.bar_color).to eq "fill-warning"
|
||||
end
|
||||
|
||||
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%'
|
||||
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%"
|
||||
end
|
||||
|
||||
context 'in order to achieve the visual effect' do
|
||||
it 'returns an x-offset equal to 60% minus the bar width' do
|
||||
expect(presenter.x_offset).to eq '0.0%'
|
||||
context "in order to achieve the visual effect" do
|
||||
it "returns an x-offset equal to 60% minus the bar width" do
|
||||
expect(presenter.x_offset).to eq "0.0%"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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) }
|
||||
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) }
|
||||
|
||||
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,
|
||||
score: score
|
||||
score: score
|
||||
expect(presenter_without_admin_data.show_partial_data_indicator?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a measure contains admin data items' do
|
||||
context "when a measure contains admin data items" do
|
||||
before :each do
|
||||
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,
|
||||
name: 'Some Title'
|
||||
name: "Some Title"
|
||||
)
|
||||
scale_with_admin_data = create(:scale, measure: measure_with_admin_data)
|
||||
create :admin_data_item,
|
||||
scale: scale_with_admin_data,
|
||||
watch_low_benchmark: watch_low_benchmark,
|
||||
growth_low_benchmark: growth_low_benchmark,
|
||||
approval_low_benchmark: approval_low_benchmark,
|
||||
ideal_low_benchmark: ideal_low_benchmark
|
||||
scale: scale_with_admin_data,
|
||||
watch_low_benchmark: watch_low_benchmark,
|
||||
growth_low_benchmark: growth_low_benchmark,
|
||||
approval_low_benchmark: approval_low_benchmark,
|
||||
ideal_low_benchmark: ideal_low_benchmark
|
||||
admin_data_presenter = VarianceChartRowPresenter.new measure: measure_with_admin_data,
|
||||
score: Score.new(
|
||||
average: 3.7, meets_teacher_threshold: true, meets_student_threshold: true
|
||||
)
|
||||
score: Score.new(
|
||||
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.partial_data_sources).to eq ['administrative data']
|
||||
expect(admin_data_presenter.partial_data_sources).to eq ["school data"]
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a measure contains teacher survey items' do
|
||||
context "when a measure contains teacher survey items" do
|
||||
before :each do
|
||||
scale = create(:scale, measure:)
|
||||
create :teacher_survey_item, scale:
|
||||
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) }
|
||||
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.partial_data_sources).to eq ['teacher survey results']
|
||||
expect(presenter.partial_data_sources).to eq ["teacher survey results"]
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there are sufficient teacher survey item responses' do
|
||||
let(:score) { Score.new(average: nil, meets_teacher_threshold: true, meets_student_threshold: true) }
|
||||
it 'does not show a partial data indicator' 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) }
|
||||
it "does not show a partial data indicator" do
|
||||
expect(presenter.show_partial_data_indicator?).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a measure contains student survey items' do
|
||||
context "when a measure contains student survey items" do
|
||||
before :each do
|
||||
scale = create(:scale, measure:)
|
||||
create :student_survey_item, scale:
|
||||
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) }
|
||||
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.partial_data_sources).to eq ['student survey results']
|
||||
expect(presenter.partial_data_sources).to eq ["student survey results"]
|
||||
end
|
||||
|
||||
context 'where there are also admin data items' do
|
||||
context "where there are also admin data items" do
|
||||
before :each do
|
||||
scale = create(:scale, measure:)
|
||||
create :admin_data_item, scale:
|
||||
end
|
||||
|
||||
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']
|
||||
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", "school data"]
|
||||
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) }
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'sorting scores' do
|
||||
it 'selects a longer bar before a shorter bar for measures in the approval/ideal zones' do
|
||||
context "sorting scores" 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:)
|
||||
create(:student_survey_item,
|
||||
scale: scale_with_student_survey_items,
|
||||
watch_low_benchmark:,
|
||||
growth_low_benchmark:,
|
||||
approval_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)
|
||||
scale: scale_with_student_survey_items,
|
||||
watch_low_benchmark:,
|
||||
growth_low_benchmark:,
|
||||
approval_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)
|
||||
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([approval_presenter, ideal_presenter].sort).to eq [ideal_presenter, approval_presenter]
|
||||
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)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,42 +1,42 @@
|
|||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
include VarianceHelper
|
||||
|
||||
describe 'overview/index' do
|
||||
describe "overview/index" do
|
||||
subject { Nokogiri::HTML(rendered) }
|
||||
|
||||
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:)
|
||||
create(:student_survey_item,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
measure
|
||||
end
|
||||
|
||||
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:)
|
||||
create(:teacher_survey_item,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
measure
|
||||
end
|
||||
|
||||
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:)
|
||||
create(:admin_data_item,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
measure
|
||||
end
|
||||
|
||||
|
|
@ -49,12 +49,12 @@ describe 'overview/index' do
|
|||
@school = create(:school)
|
||||
|
||||
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
|
||||
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
|
||||
[
|
||||
VarianceChartRowPresenter.new(measure: support_for_teaching, score: Score.new),
|
||||
|
|
@ -63,49 +63,49 @@ describe 'overview/index' do
|
|||
]
|
||||
end
|
||||
|
||||
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 & Growth; Professional Qualifications.}
|
||||
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 data and/or low survey response rates: Support For Teaching Development & Growth; Professional Qualifications.}
|
||||
end
|
||||
|
||||
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]')
|
||||
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]")
|
||||
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.first.inner_text).to include 'Effective Leadership'
|
||||
expect(displayed_variance_labels.first.inner_text).to include "Effective Leadership"
|
||||
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
|
||||
measure = create(:measure, name: 'Display Me', measure_id: 'display-me')
|
||||
measure = create(:measure, name: "Display Me", measure_id: "display-me")
|
||||
scale = create(:scale, measure:)
|
||||
create(:student_survey_item,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
[
|
||||
VarianceChartRowPresenter.new(measure:,
|
||||
score: Score.new(average: rand))
|
||||
score: Score.new(average: rand))
|
||||
]
|
||||
end
|
||||
|
||||
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}
|
||||
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 data and/or low survey response rates}
|
||||
end
|
||||
|
||||
it 'displays a variance row for each presenter' do
|
||||
displayed_variance_rows = subject.css('[data-for-measure-id]')
|
||||
it "displays a variance row for each presenter" do
|
||||
displayed_variance_rows = subject.css("[data-for-measure-id]")
|
||||
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.first.inner_text).to include 'Display Me'
|
||||
expect(displayed_variance_labels.first.inner_text).to include "Display Me"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue