mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Display measure scores for Problem Solving Emphasis [finishes #179705693]
This commit is contained in:
parent
666eec9a20
commit
3b8bcb2e22
4 changed files with 49 additions and 32 deletions
|
|
@ -6,22 +6,27 @@ feature "School dashboard", type: feature do
|
|||
|
||||
let(:measure_1A_i) { Measure.find_by_measure_id('1A-i') }
|
||||
let(:measure_2A_i) { Measure.find_by_measure_id('2A-i') }
|
||||
let(:measure_4C_i) { Measure.find_by_measure_id('4C-i') }
|
||||
|
||||
let(:survey_item_1_for_measure_1A_i) { SurveyItem.create measure: measure_1A_i, survey_item_id: rand.to_s }
|
||||
let(:survey_item_2_for_measure_1A_i) { SurveyItem.create measure: measure_1A_i, survey_item_id: rand.to_s }
|
||||
let(:survey_item_1_for_measure_2A_i) { SurveyItem.create measure: measure_2A_i, survey_item_id: rand.to_s }
|
||||
let(:survey_item_2_for_measure_2A_i) { SurveyItem.create measure: measure_2A_i, survey_item_id: rand.to_s }
|
||||
let(:survey_item_1_for_measure_4C_i) { SurveyItem.create measure: measure_4C_i, survey_item_id: rand.to_s }
|
||||
let(:survey_item_2_for_measure_4C_i) { SurveyItem.create measure: measure_4C_i, survey_item_id: rand.to_s }
|
||||
|
||||
let(:measure_row_bars) { page.all('rect.measure-row-bar') }
|
||||
|
||||
let(:ay_2020_21) { AcademicYear.find_by_range '2020-21' }
|
||||
|
||||
before :each do
|
||||
SurveyItemResponse.create response_id: '123abc', academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_measure_1A_i, likert_score: 4
|
||||
SurveyItemResponse.create response_id: '456efg', academic_year: ay_2020_21, school: school, survey_item: survey_item_2_for_measure_1A_i, likert_score: 5
|
||||
SurveyItemResponse.create response_id: rand.to_s, academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_measure_1A_i, likert_score: 4
|
||||
SurveyItemResponse.create response_id: rand.to_s, academic_year: ay_2020_21, school: school, survey_item: survey_item_2_for_measure_1A_i, likert_score: 5
|
||||
|
||||
SurveyItemResponse.create response_id: '123abc', academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_measure_2A_i, likert_score: 5
|
||||
SurveyItemResponse.create response_id: '456efg', academic_year: ay_2020_21, school: school, survey_item: survey_item_2_for_measure_2A_i, likert_score: 5
|
||||
SurveyItemResponse.create response_id: rand.to_s, academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_measure_2A_i, likert_score: 5
|
||||
SurveyItemResponse.create response_id: rand.to_s, academic_year: ay_2020_21, school: school, survey_item: survey_item_2_for_measure_2A_i, likert_score: 5
|
||||
|
||||
SurveyItemResponse.create response_id: rand.to_s, academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_measure_4C_i, likert_score: 1
|
||||
end
|
||||
|
||||
scenario "User authentication fails" do
|
||||
|
|
@ -45,9 +50,15 @@ feature "School dashboard", type: feature do
|
|||
|
||||
expect(page).to have_text('Professional Qualifications')
|
||||
expect(measure_row_bars[0]['width']).to eq '20.66%'
|
||||
expect(measure_row_bars[0]['x']).to eq '50%'
|
||||
|
||||
expect(page).to have_text('Student Physical Safety')
|
||||
expect(measure_row_bars[1]['width']).to eq '50.0%'
|
||||
expect(measure_row_bars[1]['x']).to eq '50%'
|
||||
|
||||
expect(page).to have_text('Problem Solving Emphasis')
|
||||
expect(measure_row_bars[2]['width']).to eq '50.0%'
|
||||
expect(measure_row_bars[2]['x']).to eq '0.0%'
|
||||
end
|
||||
|
||||
let(:username) { 'winchester' }
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ RSpec.describe MeasureGraphRowPresenter 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'
|
||||
end
|
||||
end
|
||||
|
|
@ -32,15 +32,15 @@ RSpec.describe MeasureGraphRowPresenter do
|
|||
|
||||
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"
|
||||
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 "37.5%"
|
||||
end
|
||||
|
||||
it('returns an x-offset of 0') do
|
||||
it 'returns an x-offset of 0' do
|
||||
expect(presenter.x_offset).to eq "50%"
|
||||
end
|
||||
end
|
||||
|
|
@ -50,15 +50,15 @@ RSpec.describe MeasureGraphRowPresenter do
|
|||
|
||||
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"
|
||||
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 "12.5%"
|
||||
end
|
||||
|
||||
it('returns an x-offset of 0') do
|
||||
it 'returns an x-offset of 0' do
|
||||
expect(presenter.x_offset).to eq "50%"
|
||||
end
|
||||
end
|
||||
|
|
@ -68,52 +68,58 @@ RSpec.describe MeasureGraphRowPresenter do
|
|||
|
||||
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"
|
||||
end
|
||||
|
||||
it('returns a bar width equal to the proportionate growth zone width') do
|
||||
expect(presenter.bar_width).to eq "3.33%"
|
||||
it 'returns a bar width equal to the proportionate growth zone width' do
|
||||
expect(presenter.bar_width).to eq "13.33%"
|
||||
end
|
||||
|
||||
it('returns an x-offset equal to the bar width') do
|
||||
expect(presenter.x_offset).to eq "46.67%"
|
||||
context 'in order to achieve the visual effect' do
|
||||
it 'returns an x-offset equal to 50% minus the bar width' do
|
||||
expect(presenter.x_offset).to eq "36.67%"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context('when the score is in the Watch zone') do
|
||||
let(:score) { 3.0 }
|
||||
let(:score) { 2.9 }
|
||||
|
||||
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"
|
||||
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 "25.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 "33.33%"
|
||||
end
|
||||
|
||||
it('returns an x-offset equal to the bar width') do
|
||||
expect(presenter.x_offset).to eq "25.0%"
|
||||
context 'in order to achieve the visual effect' do
|
||||
it 'returns an x-offset equal to 50% minus the bar width' do
|
||||
expect(presenter.x_offset).to eq "16.67%"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context('when the score is in the Warning zone') do
|
||||
let(:score) { 2.8 }
|
||||
let(:score) { 1.0 }
|
||||
|
||||
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"
|
||||
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 "49.12%"
|
||||
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 "50.0%"
|
||||
end
|
||||
|
||||
it('returns an x-offset equal to the bar width') do
|
||||
expect(presenter.x_offset).to eq "0.88%"
|
||||
context 'in order to achieve the visual effect' do
|
||||
it 'returns an x-offset equal to 50% minus the bar width' do
|
||||
expect(presenter.x_offset).to eq "0.0%"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue