Modify behavior of insufficient data indicators for admin data items. Now we show indicators in line with the admin data item descriptions to indicate which items are missing data

This commit is contained in:
rebuilt 2022-07-06 15:54:29 -07:00
parent 7c0794f261
commit deaf13c976
15 changed files with 251 additions and 62 deletions

View file

@ -60,7 +60,6 @@ describe 'analyze/index' do
render
end
context 'when all the presenters have a nil score' do
# let(:grouped_bar_column_presenters) do
# measure = create(:measure, name: 'Display Me', measure_id: 'display-me')
@ -114,7 +113,4 @@ describe 'analyze/index' do
expect(year_checkbox).to have_attribute 'disabled'
end
end
context 'when presenters have a score' do
end
end

View file

@ -2,41 +2,71 @@ require 'rails_helper'
include GaugeHelper
describe 'categories/show' do
subject { Nokogiri::HTML(rendered) }
let(:academic_year) { create(:academic_year, range: '1989-90') }
let(:school) { create(:school, name: 'Best School') }
let(:category) { create(:category, name: 'Some Category', description: 'Some description of the category') }
let(:category_presenter) { CategoryPresenter.new(category:) }
let(:subcategory1) do
create(:subcategory, category:, name: 'A subcategory', description: 'Some description of the subcategory')
end
let(:subcategory2) do
create(:subcategory, category:, name: 'Another subcategory',
description: 'Another description of the subcategory')
end
let(:measure1) { create(:measure, subcategory: subcategory1) }
let(:scale1) { create(:student_scale, measure: measure1) }
let(:survey_item1) do
create(:student_survey_item, scale: scale1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5,
approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
end
let(:measure2) do
create(:measure, name: 'The second measure name', description: 'The second measure description', measure_id: '1A-i',
subcategory: subcategory2)
end
let(:scale2) { create(:student_scale, measure: measure2) }
let(:scale3) { create(:teacher_scale, measure: measure2) }
let(:student_survey_item) do
create(:student_survey_item, scale: scale2, prompt: 'Some prompt for student data',
watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
end
let(:teacher_survey_item) { create(:teacher_survey_item, scale: scale3, prompt: 'Some prompt for teacher data') }
let(:admin_data_scale) { create(:scale, measure: measure2) }
let(:admin_data_item) do
create(:admin_data_item, scale: admin_data_scale, description: 'Some admin data item description',
watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
end
before :each do
academic_year = create(:academic_year, range: '1989-90')
school = create(:school, name: 'Best School')
academic_year
school
category = create(:category, name: 'Some Category', description: 'Some description of the category')
category_presenter = CategoryPresenter.new(category:)
category
category_presenter
subcategory1 = create(:subcategory, category:, name: 'A subcategory',
description: 'Some description of the subcategory')
subcategory2 = create(:subcategory, category:, name: 'Another subcategory',
description: 'Another description of the subcategory')
subcategory1
subcategory2
measure1 = create(:measure, subcategory: subcategory1)
scale1 = create(:student_scale, measure: measure1)
survey_item1 = create(:student_survey_item, scale: scale1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5,
approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
measure1
scale1
survey_item1
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: survey_item1,
academic_year:, school:, likert_score: 3)
measure2 = create(:measure, name: 'The second measure name', description: 'The second measure description',
subcategory: subcategory2)
scale2 = create(:student_scale, measure: measure2)
scale3 = create(:teacher_scale, measure: measure2)
student_survey_item = create(:student_survey_item, scale: scale2, prompt: 'Some prompt for student data',
watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
measure2
scale2
scale3
student_survey_item
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD,
survey_item: student_survey_item, academic_year:, school:, likert_score: 5)
teacher_survey_item = create(:teacher_survey_item, scale: scale3, prompt: 'Some prompt for teacher data')
teacher_survey_item
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD,
survey_item: teacher_survey_item, academic_year:, school:, likert_score: 3)
admin_data_scale = create(:scale, measure: measure2)
create(:admin_data_item, scale: admin_data_scale, description: 'Some admin data item description',
watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
admin_data_scale
admin_data_item
assign :category, category_presenter
assign :categories, [category_presenter]
@ -47,15 +77,22 @@ describe 'categories/show' do
create(:respondent, school:, academic_year:)
create(:survey, school:, academic_year:)
render
end
it 'renders the category name and description' do
expect(rendered).to match(/Some Category/)
expect(rendered).to match(/Some description of the category/)
context 'for each category' do
before do
render
end
it 'renders the category name and description' do
expect(rendered).to match(/Some Category/)
expect(rendered).to match(/Some description of the category/)
end
end
context 'for each subcategory' do
before do
render
end
it 'renders the subcategory name' do
expect(rendered).to match(/A subcategory/)
expect(rendered).to match(/Another subcategory/)
@ -73,6 +110,9 @@ describe 'categories/show' do
end
context 'for each measure' do
before do
render
end
it 'renders the measure name' do
expect(rendered).to match(/The second measure name/)
end
@ -92,4 +132,43 @@ describe 'categories/show' do
expect(rendered).to match(/Some admin data item description/)
end
end
context 'when the measure does NOT have admin data values' do
before do
render
end
it 'renders the insufficient data exclamation point icon' do
exclamation_points = subject.css('[data-exclamation-point]')
expect(exclamation_points.first.attribute('data-exclamation-point').value).to eq 'admin-data-items-1A-i'
end
it 'renders the insufficient data message' do
exclamation_points = subject.css('[data-insufficient-data-message]')
expect(exclamation_points.first.attribute('data-insufficient-data-message').value).to eq 'admin-data-items-1A-i-limited availability'
end
it 'renders the insufficient data exclamation point icons next to the description of the missing admin data item' do
exclamation_points = subject.css('[data-missing-data]')
expect(exclamation_points.first.attribute('data-missing-data').value).to eq "#{admin_data_item.admin_data_item_id}"
end
end
context 'when the measure DOES have admin data values' do
before :each do
create(:admin_data_value, admin_data_item:, school:, academic_year:, likert_score: 2)
render
end
it 'does not render the insufficient data exclamation point icon' do
exclamation_points = subject.css('[data-exclamation-point]')
expect(exclamation_points.count).to eq 0
end
it 'does not render the insufficient data message ' do
exclamation_points = subject.css('[data-insufficient-data-message]')
expect(exclamation_points.count).to eq 0
end
it 'Does NOT render the insufficient data exclamation point icons next to the description of the missing admin data item' do
exclamation_points = subject.css('[data-missing-data]')
expect(exclamation_points.count).to eq 0
end
end
end