diff --git a/app/models/income.rb b/app/models/income.rb index 447f8465..f92b73b5 100644 --- a/app/models/income.rb +++ b/app/models/income.rb @@ -4,4 +4,15 @@ class Income < ApplicationRecord include FriendlyId friendly_id :designation, use: [:slugged] + + def label + case designation + when "Economically Disadvantaged - Y" + "Economically Disadvantaged" + when "Economically Disadvantaged - N" + "Not Economically Disadvantaged" + when "Unknown" + "Unknown" + end + end end diff --git a/app/presenters/analyze/graph/column/all_admin.rb b/app/presenters/analyze/graph/column/all_admin.rb index 57fe7799..d63c9276 100644 --- a/app/presenters/analyze/graph/column/all_admin.rb +++ b/app/presenters/analyze/graph/column/all_admin.rb @@ -5,7 +5,7 @@ module Analyze module Column class AllAdmin < GroupedBarColumnPresenter def label - "All Admin" + %w[All Admin] end def basis diff --git a/app/presenters/analyze/graph/column/all_student.rb b/app/presenters/analyze/graph/column/all_student.rb index ed133d34..788dca38 100644 --- a/app/presenters/analyze/graph/column/all_student.rb +++ b/app/presenters/analyze/graph/column/all_student.rb @@ -5,7 +5,7 @@ module Analyze module Column class AllStudent < GroupedBarColumnPresenter def label - "All Students" + %w[All Students] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/all_survey_data.rb b/app/presenters/analyze/graph/column/all_survey_data.rb index 1e4d5e2c..c3e42c94 100644 --- a/app/presenters/analyze/graph/column/all_survey_data.rb +++ b/app/presenters/analyze/graph/column/all_survey_data.rb @@ -5,7 +5,7 @@ module Analyze module Column class AllSurveyData < GroupedBarColumnPresenter def label - "Survey Data" + %w[Survey Data] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/all_teacher.rb b/app/presenters/analyze/graph/column/all_teacher.rb index 1b7b7ddc..dc3a8443 100644 --- a/app/presenters/analyze/graph/column/all_teacher.rb +++ b/app/presenters/analyze/graph/column/all_teacher.rb @@ -5,7 +5,7 @@ module Analyze module Column class AllTeacher < GroupedBarColumnPresenter def label - "All Teachers" + %w[All Teachers] end def basis diff --git a/app/presenters/analyze/graph/column/gender_column/female.rb b/app/presenters/analyze/graph/column/gender_column/female.rb index e55691bf..54941fbf 100644 --- a/app/presenters/analyze/graph/column/gender_column/female.rb +++ b/app/presenters/analyze/graph/column/gender_column/female.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::GenderColumn::ScoreForGender include Analyze::Graph::Column::GenderColumn::GenderCount def label - "Female" + %w[Female] end def basis diff --git a/app/presenters/analyze/graph/column/gender_column/male.rb b/app/presenters/analyze/graph/column/gender_column/male.rb index 7158d2d8..031b91e6 100644 --- a/app/presenters/analyze/graph/column/gender_column/male.rb +++ b/app/presenters/analyze/graph/column/gender_column/male.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::GenderColumn::ScoreForGender include Analyze::Graph::Column::GenderColumn::GenderCount def label - "Male" + %w[Male] end def basis diff --git a/app/presenters/analyze/graph/column/gender_column/non_binary.rb b/app/presenters/analyze/graph/column/gender_column/non_binary.rb index c9e4cda0..8b3c8547 100644 --- a/app/presenters/analyze/graph/column/gender_column/non_binary.rb +++ b/app/presenters/analyze/graph/column/gender_column/non_binary.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::GenderColumn::ScoreForGender include Analyze::Graph::Column::GenderColumn::GenderCount def label - "Non-Binary" + %w[Non-Binary] end def basis diff --git a/app/presenters/analyze/graph/column/gender_column/unknown.rb b/app/presenters/analyze/graph/column/gender_column/unknown.rb index f8e119cd..d954cece 100644 --- a/app/presenters/analyze/graph/column/gender_column/unknown.rb +++ b/app/presenters/analyze/graph/column/gender_column/unknown.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::GenderColumn::ScoreForGender include Analyze::Graph::Column::GenderColumn::GenderCount def label - "Unknown" + %w[Unknown] end def basis diff --git a/app/presenters/analyze/graph/column/grade/eight.rb b/app/presenters/analyze/graph/column/grade/eight.rb index ca31d21d..8d4bf62f 100644 --- a/app/presenters/analyze/graph/column/grade/eight.rb +++ b/app/presenters/analyze/graph/column/grade/eight.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 8" + %w[Grade 8] end def basis diff --git a/app/presenters/analyze/graph/column/grade/eleven.rb b/app/presenters/analyze/graph/column/grade/eleven.rb index 5a6a2e41..dba11366 100644 --- a/app/presenters/analyze/graph/column/grade/eleven.rb +++ b/app/presenters/analyze/graph/column/grade/eleven.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 11" + %w[Grade 11] end def basis diff --git a/app/presenters/analyze/graph/column/grade/five.rb b/app/presenters/analyze/graph/column/grade/five.rb index 5eb75d15..30033e31 100644 --- a/app/presenters/analyze/graph/column/grade/five.rb +++ b/app/presenters/analyze/graph/column/grade/five.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 5" + %w[Grade 5] end def basis diff --git a/app/presenters/analyze/graph/column/grade/four.rb b/app/presenters/analyze/graph/column/grade/four.rb index 6477ec4e..1f563742 100644 --- a/app/presenters/analyze/graph/column/grade/four.rb +++ b/app/presenters/analyze/graph/column/grade/four.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 4" + %w[Grade 4] end def basis diff --git a/app/presenters/analyze/graph/column/grade/nine.rb b/app/presenters/analyze/graph/column/grade/nine.rb index ebdff840..9c3a9397 100644 --- a/app/presenters/analyze/graph/column/grade/nine.rb +++ b/app/presenters/analyze/graph/column/grade/nine.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 9" + %w[Grade 9] end def basis diff --git a/app/presenters/analyze/graph/column/grade/one.rb b/app/presenters/analyze/graph/column/grade/one.rb index a2163a1d..b1e3bcde 100644 --- a/app/presenters/analyze/graph/column/grade/one.rb +++ b/app/presenters/analyze/graph/column/grade/one.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 1" + %w[Grade 1] end def basis diff --git a/app/presenters/analyze/graph/column/grade/seven.rb b/app/presenters/analyze/graph/column/grade/seven.rb index 729c6301..6aa5a818 100644 --- a/app/presenters/analyze/graph/column/grade/seven.rb +++ b/app/presenters/analyze/graph/column/grade/seven.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 7" + %w[Grade 7] end def basis diff --git a/app/presenters/analyze/graph/column/grade/six.rb b/app/presenters/analyze/graph/column/grade/six.rb index b30d8fd0..1e40703b 100644 --- a/app/presenters/analyze/graph/column/grade/six.rb +++ b/app/presenters/analyze/graph/column/grade/six.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 6" + %w[Grade 6] end def basis diff --git a/app/presenters/analyze/graph/column/grade/ten.rb b/app/presenters/analyze/graph/column/grade/ten.rb index 86e94930..45839d31 100644 --- a/app/presenters/analyze/graph/column/grade/ten.rb +++ b/app/presenters/analyze/graph/column/grade/ten.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 10" + %w[Grade 10] end def basis diff --git a/app/presenters/analyze/graph/column/grade/three.rb b/app/presenters/analyze/graph/column/grade/three.rb index c5ce994f..44a32772 100644 --- a/app/presenters/analyze/graph/column/grade/three.rb +++ b/app/presenters/analyze/graph/column/grade/three.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 3" + %w[Grade 3] end def basis diff --git a/app/presenters/analyze/graph/column/grade/twelve.rb b/app/presenters/analyze/graph/column/grade/twelve.rb index 6d1defc3..0a8f7a26 100644 --- a/app/presenters/analyze/graph/column/grade/twelve.rb +++ b/app/presenters/analyze/graph/column/grade/twelve.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 12" + %w[Grade 12] end def basis diff --git a/app/presenters/analyze/graph/column/grade/two.rb b/app/presenters/analyze/graph/column/grade/two.rb index 9bb80df3..195661e1 100644 --- a/app/presenters/analyze/graph/column/grade/two.rb +++ b/app/presenters/analyze/graph/column/grade/two.rb @@ -5,12 +5,10 @@ module Analyze module Column module Grade class Two < GroupedBarColumnPresenter - attr_reader :sufficient_responses - include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Grade 2" + %w[Grade 2] end def basis diff --git a/app/presenters/analyze/graph/column/grade/zero.rb b/app/presenters/analyze/graph/column/grade/zero.rb index 64e213ae..611f9d3a 100644 --- a/app/presenters/analyze/graph/column/grade/zero.rb +++ b/app/presenters/analyze/graph/column/grade/zero.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::Grade::ScoreForGrade include Analyze::Graph::Column::Grade::GradeCount def label - "Kindergarten" + %w[Kindergarten] end def basis diff --git a/app/presenters/analyze/graph/column/grouped_bar_column_presenter.rb b/app/presenters/analyze/graph/column/grouped_bar_column_presenter.rb index e59a9257..37713a6d 100644 --- a/app/presenters/analyze/graph/column/grouped_bar_column_presenter.rb +++ b/app/presenters/analyze/graph/column/grouped_bar_column_presenter.rb @@ -39,7 +39,7 @@ module Analyze end def label - "All Data" + %w[All Data] end def basis diff --git a/app/presenters/analyze/graph/column/income_column/disadvantaged.rb b/app/presenters/analyze/graph/column/income_column/disadvantaged.rb index ad304ce9..ea079577 100644 --- a/app/presenters/analyze/graph/column/income_column/disadvantaged.rb +++ b/app/presenters/analyze/graph/column/income_column/disadvantaged.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::IncomeColumn::ScoreForIncome include Analyze::Graph::Column::IncomeColumn::IncomeCount def label - "Economically Disadvantaged" + %w[Economically Disadvantaged] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/income_column/not_disadvantaged.rb b/app/presenters/analyze/graph/column/income_column/not_disadvantaged.rb index 4a1d4c21..aea9ce83 100644 --- a/app/presenters/analyze/graph/column/income_column/not_disadvantaged.rb +++ b/app/presenters/analyze/graph/column/income_column/not_disadvantaged.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::IncomeColumn::ScoreForIncome include Analyze::Graph::Column::IncomeColumn::IncomeCount def label - "Not Disadvantaged" + ["Not Economically", "Disadvantaged"] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/income_column/unknown.rb b/app/presenters/analyze/graph/column/income_column/unknown.rb index e6e0ba8b..bc8c6d2c 100644 --- a/app/presenters/analyze/graph/column/income_column/unknown.rb +++ b/app/presenters/analyze/graph/column/income_column/unknown.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::IncomeColumn::ScoreForIncome include Analyze::Graph::Column::IncomeColumn::IncomeCount def label - "Unknown" + ["Unknown"] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/american_indian.rb b/app/presenters/analyze/graph/column/race_column/american_indian.rb index 25e46da6..b5d2af8d 100644 --- a/app/presenters/analyze/graph/column/race_column/american_indian.rb +++ b/app/presenters/analyze/graph/column/race_column/american_indian.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::ScoreForRace include Analyze::Graph::Column::RaceColumn::RaceCount def label - "American Indian" + %w[American Indian] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/asian.rb b/app/presenters/analyze/graph/column/race_column/asian.rb index c60b012e..7b0af7f8 100644 --- a/app/presenters/analyze/graph/column/race_column/asian.rb +++ b/app/presenters/analyze/graph/column/race_column/asian.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::ScoreForRace include Analyze::Graph::Column::RaceColumn::RaceCount def label - "Asian" + %w[Asian] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/black.rb b/app/presenters/analyze/graph/column/race_column/black.rb index 6433068e..72046c97 100644 --- a/app/presenters/analyze/graph/column/race_column/black.rb +++ b/app/presenters/analyze/graph/column/race_column/black.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::ScoreForRace include Analyze::Graph::Column::RaceColumn::RaceCount def label - "Black" + %w[Black] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/hispanic.rb b/app/presenters/analyze/graph/column/race_column/hispanic.rb index 1a902d90..6f92a77e 100644 --- a/app/presenters/analyze/graph/column/race_column/hispanic.rb +++ b/app/presenters/analyze/graph/column/race_column/hispanic.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::ScoreForRace include Analyze::Graph::Column::RaceColumn::RaceCount def label - "Hispanic" + %w[Hispanic] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/middle_eastern.rb b/app/presenters/analyze/graph/column/race_column/middle_eastern.rb index 80e5089e..36955bf2 100644 --- a/app/presenters/analyze/graph/column/race_column/middle_eastern.rb +++ b/app/presenters/analyze/graph/column/race_column/middle_eastern.rb @@ -9,7 +9,7 @@ module Analyze include Analyze::Graph::Column::RaceColumn::RaceCount def label - "Middle Eastern" + %w[Middle Eastern] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/multiracial.rb b/app/presenters/analyze/graph/column/race_column/multiracial.rb index 85b359fb..c150cea1 100644 --- a/app/presenters/analyze/graph/column/race_column/multiracial.rb +++ b/app/presenters/analyze/graph/column/race_column/multiracial.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::ScoreForRace include Analyze::Graph::Column::RaceColumn::RaceCount def label - "Multiracial" + %w[Multiracial] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/unknown.rb b/app/presenters/analyze/graph/column/race_column/unknown.rb index 25e130c0..8c6b786f 100644 --- a/app/presenters/analyze/graph/column/race_column/unknown.rb +++ b/app/presenters/analyze/graph/column/race_column/unknown.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::ScoreForRace include Analyze::Graph::Column::RaceColumn::RaceCount def label - "Not Listed" + %w[Not Listed] end def show_irrelevancy_message? diff --git a/app/presenters/analyze/graph/column/race_column/white.rb b/app/presenters/analyze/graph/column/race_column/white.rb index 3dbf3695..221ecc8b 100644 --- a/app/presenters/analyze/graph/column/race_column/white.rb +++ b/app/presenters/analyze/graph/column/race_column/white.rb @@ -8,7 +8,7 @@ module Analyze include Analyze::Graph::Column::ScoreForRace include Analyze::Graph::Column::RaceColumn::RaceCount def label - "White" + %w[White] end def show_irrelevancy_message? diff --git a/app/services/survey_item_values.rb b/app/services/survey_item_values.rb index 80a56e63..f47e3038 100644 --- a/app/services/survey_item_values.rb +++ b/app/services/survey_item_values.rb @@ -110,7 +110,6 @@ class SurveyItemValues @raw_income ||= disaggregation.income end - # TODO: - rename these cases def income @income ||= value_from(pattern: /^Income$/i) return @income if @income.present? @@ -234,4 +233,3 @@ class SurveyItemValues end end end - diff --git a/app/views/analyze/_group_selectors.html.erb b/app/views/analyze/_group_selectors.html.erb index 72bd8d38..61f21184 100644 --- a/app/views/analyze/_group_selectors.html.erb +++ b/app/views/analyze/_group_selectors.html.erb @@ -19,5 +19,5 @@ <% end %> <% @presenter.incomes.each do |income| %> - <%= render(partial: "checkboxes", locals: {id: "income-#{income.slug}", item: income, selected_items: @presenter.selected_incomes, name: "income", label_text: income.designation}) %> + <%= render(partial: "checkboxes", locals: {id: "income-#{income.slug}", item: income, selected_items: @presenter.selected_incomes, name: "income", label_text: income.label}) %> <% end %> diff --git a/app/views/analyze/_grouped_bar_column.html.erb b/app/views/analyze/_grouped_bar_column.html.erb index 2f7fa614..65f1fc21 100644 --- a/app/views/analyze/_grouped_bar_column.html.erb +++ b/app/views/analyze/_grouped_bar_column.html.erb @@ -25,7 +25,7 @@ <% end %> - <% words = column.label.split("\s") %> + <% words = column.label %> <% words.each_with_index do | line, index | %> <%= line %> diff --git a/spec/presenters/grouped_bar_column_presenter_spec.rb b/spec/presenters/grouped_bar_column_presenter_spec.rb index a7765162..fb60b5c6 100644 --- a/spec/presenters/grouped_bar_column_presenter_spec.rb +++ b/spec/presenters/grouped_bar_column_presenter_spec.rb @@ -1,11 +1,11 @@ -require 'rails_helper' +require "rails_helper" include AnalyzeHelper include Analyze::Graph::Column describe GroupedBarColumnPresenter do let(:school) { create(:school) } - let(:academic_year) { create(:academic_year, range: '1900-01') } - let(:another_academic_year) { create(:academic_year, range: '2000-01') } + let(:academic_year) { create(:academic_year, range: "1900-01") } + let(:another_academic_year) { create(:academic_year, range: "2000-01") } let(:academic_years) { [academic_year, another_academic_year] } let(:year_index) { academic_years.find_index(academic_year) } let(:watch_low_benchmark) { 2 } @@ -13,7 +13,7 @@ describe GroupedBarColumnPresenter do let(:approval_low_benchmark) { 4 } let(:ideal_low_benchmark) { 4.5 } - let(:measure_with_student_survey_items) { create(:measure, name: 'Student measure') } + let(:measure_with_student_survey_items) { create(:measure, name: "Student measure") } let(:scale_with_student_survey_item) { create(:student_scale, measure: measure_with_student_survey_items) } let(:student_survey_item) do create(:student_survey_item, scale: scale_with_student_survey_item, @@ -23,7 +23,7 @@ describe GroupedBarColumnPresenter do ideal_low_benchmark:) end - let(:measure_with_teacher_survey_items) { create(:measure, name: 'Teacher measure') } + let(:measure_with_teacher_survey_items) { create(:measure, name: "Teacher measure") } let(:scale_with_teacher_survey_item) { create(:teacher_scale, measure: measure_with_teacher_survey_items) } let(:teacher_survey_item) do create(:teacher_survey_item, scale: scale_with_teacher_survey_item, @@ -33,7 +33,7 @@ describe GroupedBarColumnPresenter do ideal_low_benchmark:) end - let(:measure_composed_of_student_and_teacher_items) { create(:measure, name: 'Student and teacher measure') } + let(:measure_composed_of_student_and_teacher_items) { create(:measure, name: "Student and teacher measure") } let(:student_scale_for_composite_measure) do create(:student_scale, measure: measure_composed_of_student_and_teacher_items) end @@ -58,7 +58,7 @@ describe GroupedBarColumnPresenter do let(:measure_without_admin_data_items) do create( :measure, - name: 'Some Title' + name: "Some Title" ) end @@ -81,32 +81,32 @@ describe GroupedBarColumnPresenter do create(:respondent, school:, academic_year:, total_students: 1, total_teachers: 1) end - shared_examples_for 'measure_name' do - it 'returns the measure name' do - expect(student_presenter.measure_name).to eq 'Student measure' + shared_examples_for "measure_name" do + it "returns the measure name" do + expect(student_presenter.measure_name).to eq "Student measure" end end - shared_examples_for 'column_midpoint' do - it 'return an x position centered in the width of the column' do + shared_examples_for "column_midpoint" do + it "return an x position centered in the width of the column" do expect(student_presenter.column_midpoint).to eq 29 end end - shared_examples_for 'bar_color' do - it 'returns the correct color' do + shared_examples_for "bar_color" do + it "returns the correct color" do expect(student_presenter.bars[year_index].color).to eq colors[year_index] end end - shared_examples_for 'y_offset' do - it 'bar will be based on the approval low benchmark boundary' do + shared_examples_for "y_offset" do + it "bar will be based on the approval low benchmark boundary" do expect(student_presenter.bars[year_index].y_offset).to be_within(0.01).of(34) end end - context 'for a grouped column presenter with both student and teacher responses' do - context 'with a single year' + context "for a grouped column presenter with both student and teacher responses" do + context "with a single year" before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item_for_composite_measure, @@ -119,49 +119,49 @@ describe GroupedBarColumnPresenter do likert_score: 5) end - it 'returns a score that is an average of the likert scores ' do + it "returns a score that is an average of the likert scores " do expect(all_data_presenter.score(0).average).to eq 4.5 expect(all_data_presenter.score(1).average).to eq nil expect(all_data_presenter.academic_years[0].range).to be academic_year.range expect(all_data_presenter.academic_years[1].range).to be another_academic_year.range end - context 'when more than one year exists' do + context "when more than one year exists" do before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item_for_composite_measure, school:, academic_year: another_academic_year, likert_score: 5) create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item_for_composite_measure, school:, academic_year: another_academic_year, likert_score: 3) end - it 'returns independent scores for each year of data' do + it "returns independent scores for each year of data" do expect(all_data_presenter.score(0).average).to eq 4.5 expect(all_data_presenter.score(1).average).to eq 4 end end end - context 'when a measure is based on student survey items' do - context 'when there is insufficient data to show a score' do - it_behaves_like 'measure_name' - it_behaves_like 'column_midpoint' + context "when a measure is based on student survey items" do + context "when there is insufficient data to show a score" do + it_behaves_like "measure_name" + it_behaves_like "column_midpoint" - it 'returns an emtpy set of bars' do + it "returns an emtpy set of bars" do expect(student_presenter.bars).to eq [] end - it 'returns an emty score' do + it "returns an emty score" do expect(student_presenter.score(year_index).average).to eq nil end - it 'shows the irrelevancy message ' do + it "shows the irrelevancy message " do expect(student_presenter.show_irrelevancy_message?).to eq true end - it 'shows the insufficient data message' do + it "shows the insufficient data message" do expect(student_presenter.show_insufficient_data_message?).to eq true end end - context 'when the score is in the Ideal zone' do + context "when the score is in the Ideal zone" do before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, school:, academic_year:, likert_score: 5) @@ -169,39 +169,39 @@ describe GroupedBarColumnPresenter do academic_year:, likert_score: 4) end - it_behaves_like 'measure_name' - it_behaves_like 'column_midpoint' - it_behaves_like 'bar_color' + it_behaves_like "measure_name" + it_behaves_like "column_midpoint" + it_behaves_like "bar_color" - it 'returns a bar width equal to the approval zone width plus the proportionate ideal zone height' do + it "returns a bar width equal to the approval zone width plus the proportionate ideal zone height" do expect(student_presenter.bars[year_index].bar_height_percentage).to be_within(0.01).of(17) end - it 'returns a y_offset equal to the ' do + it "returns a y_offset equal to the " do expect(student_presenter.bars[0].y_offset).to be_within(0.01).of(17) end - it 'returns a text representation of the type of survey the bars are based on' do - expect(student_presenter.basis).to eq 'student surveys' + it "returns a text representation of the type of survey the bars are based on" do + expect(student_presenter.basis).to eq "student surveys" end - it 'returns only bars that have a numeric score' do + it "returns only bars that have a numeric score" do expect(student_presenter.bars.count).to be 1 end - it 'returns an explanatory bar label' do - expect(student_presenter.label).to eq 'All Students' + it "returns an explanatory bar label" do + expect(student_presenter.label).to eq %w[All Students] end - it 'does not show a message that the data source is irrelevant for this measure' do + it "does not show a message that the data source is irrelevant for this measure" do expect(student_presenter.show_irrelevancy_message?).to be false end - it 'does not show a message about insufficient responses' do + it "does not show a message about insufficient responses" do expect(student_presenter.show_insufficient_data_message?).to be false end - context 'when there is more than one years worth of data to show' do + context "when there is more than one years worth of data to show" do before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, school:, academic_year: another_academic_year, likert_score: 3) @@ -209,24 +209,24 @@ describe GroupedBarColumnPresenter do academic_year: another_academic_year, likert_score: 4) end - it 'returns only bars that have a numeric score' do + it "returns only bars that have a numeric score" do expect(student_presenter.bars.count).to be 2 end end end - context 'when the score is in the Approval zone' do + context "when the score is in the Approval zone" do before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, school:, academic_year:, likert_score: 4) end - it_behaves_like 'measure_name' - it_behaves_like 'column_midpoint' - it_behaves_like 'bar_color' + it_behaves_like "measure_name" + it_behaves_like "column_midpoint" + it_behaves_like "bar_color" # it_behaves_like 'y_offset' - context 'and the score is right at the approval low benchmark' do + context "and the score is right at the approval low benchmark" do it "where bar would normally have a height of 0, we inflate the height to be at least the minimum bar height of #{Analyze::BarPresenter::MINIMUM_BAR_HEIGHT}" do expect(student_presenter.bars[year_index].bar_height_percentage).to be_within(0.01).of(Analyze::BarPresenter::MINIMUM_BAR_HEIGHT) end @@ -236,22 +236,22 @@ describe GroupedBarColumnPresenter do end end end - context 'when the score is in the Growth zone' do + context "when the score is in the Growth zone" do before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, school:, academic_year:, likert_score: 3) end - it_behaves_like 'measure_name' - it_behaves_like 'column_midpoint' - it_behaves_like 'bar_color' - it_behaves_like 'y_offset' + it_behaves_like "measure_name" + it_behaves_like "column_midpoint" + it_behaves_like "bar_color" + it_behaves_like "y_offset" - 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(student_presenter.bars[year_index].bar_height_percentage).to be_within(0.01).of(17) end - context 'when the score is less than 5 percent away from the approval low benchmark line' do + context "when the score is less than 5 percent away from the approval low benchmark line" do before do create_list(:survey_item_response, 80, survey_item: student_survey_item, school:, academic_year:, likert_score: 4) @@ -263,51 +263,51 @@ describe GroupedBarColumnPresenter do end end - context 'when the score is in the Watch zone' do + context "when the score is in the Watch zone" do before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, school:, academic_year:, likert_score: 2) end - it_behaves_like 'measure_name' - it_behaves_like 'column_midpoint' - it_behaves_like 'bar_color' - it_behaves_like 'y_offset' + it_behaves_like "measure_name" + it_behaves_like "column_midpoint" + it_behaves_like "bar_color" + it_behaves_like "y_offset" - 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(student_presenter.bars[year_index].bar_height_percentage).to eq 34 end end - context 'when the score is in the Warning zone' do + context "when the score is in the Warning zone" do before do create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: student_survey_item, school:, academic_year:, likert_score: 1) end - it_behaves_like 'measure_name' - it_behaves_like 'column_midpoint' - it_behaves_like 'bar_color' - it_behaves_like 'y_offset' + it_behaves_like "measure_name" + it_behaves_like "column_midpoint" + it_behaves_like "bar_color" + it_behaves_like "y_offset" - 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(student_presenter.bars[year_index].bar_height_percentage).to eq 51 end end end - context 'when the measure is based on teacher survey items' do - context 'when there are insufficient responses to calculate a score' do - it 'indicates it should show the insufficient data message' do + context "when the measure is based on teacher survey items" do + context "when there are insufficient responses to calculate a score" do + it "indicates it should show the insufficient data message" do expect(teacher_presenter.show_insufficient_data_message?).to eq true end end - context 'when there are enough responses to calculate a score' do + context "when there are enough responses to calculate a score" do before do create(:survey_item_response, survey_item: teacher_survey_item, school:, academic_year:) end - it 'indicates it should show the insufficient data message' do + it "indicates it should show the insufficient data message" do expect(teacher_presenter.show_insufficient_data_message?).to eq false end end