From c33c00b845be647103f7e530314242dd21972b61 Mon Sep 17 00:00:00 2001 From: rebuilt Date: Thu, 20 Apr 2023 20:58:15 -0700 Subject: [PATCH] Rename DataAvailability to Summary --- app/models/data_availability.rb | 4 ---- app/models/summary.rb | 4 ++++ app/models/survey_item.rb | 2 +- app/presenters/admin_data_presenter.rb | 8 ++++---- app/presenters/teacher_survey_presenter.rb | 6 +++--- .../admin_data_presenter_spec.rb | 12 ++++++------ .../student_survey_presenter.rb | 8 ++++---- .../teacher_survey_presenter_spec.rb | 14 +++++++------- 8 files changed, 29 insertions(+), 29 deletions(-) delete mode 100644 app/models/data_availability.rb create mode 100644 app/models/summary.rb diff --git a/app/models/data_availability.rb b/app/models/data_availability.rb deleted file mode 100644 index 5f710a1d..00000000 --- a/app/models/data_availability.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -class DataAvailability < Struct.new(:id, :description, :available?) -end diff --git a/app/models/summary.rb b/app/models/summary.rb new file mode 100644 index 00000000..1ee6ef29 --- /dev/null +++ b/app/models/summary.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +class Summary < Struct.new(:id, :description, :available?) +end diff --git a/app/models/survey_item.rb b/app/models/survey_item.rb index 4160dce4..bab65b2d 100644 --- a/app/models/survey_item.rb +++ b/app/models/survey_item.rb @@ -60,6 +60,6 @@ class SurveyItem < ActiveRecord::Base # TODO: rename this to Summary def description - DataAvailability.new(survey_item_id, prompt, true) + Summary.new(survey_item_id, prompt, true) end end diff --git a/app/presenters/admin_data_presenter.rb b/app/presenters/admin_data_presenter.rb index e90402d5..3bff1347 100644 --- a/app/presenters/admin_data_presenter.rb +++ b/app/presenters/admin_data_presenter.rb @@ -7,7 +7,7 @@ class AdminDataPresenter < DataItemPresenter end def title - "School 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) + Summary.new(admin_data_item.admin_data_item_id, admin_data_item.description, + admin_data_item.admin_data_values.where(school:, academic_year:).count > 0) end end end diff --git a/app/presenters/teacher_survey_presenter.rb b/app/presenters/teacher_survey_presenter.rb index 5e4e99fb..7924ac38 100644 --- a/app/presenters/teacher_survey_presenter.rb +++ b/app/presenters/teacher_survey_presenter.rb @@ -22,12 +22,12 @@ class TeacherSurveyPresenter < DataItemPresenter def descriptions_and_availability if @measure_id == '1B-i' - return [DataAvailability.new('1B-i', 'Items available upon request to Lowell Public Schools.', - true)] + return [Summary.new('1B-i', 'Items available upon request to Lowell Public Schools', + true)] end survey_items.map do |survey_item| - DataAvailability.new(survey_item.survey_item_id, survey_item.prompt, true) + Summary.new(survey_item.survey_item_id, survey_item.prompt, true) end end end diff --git a/spec/presenters/data_item_presenters/admin_data_presenter_spec.rb b/spec/presenters/data_item_presenters/admin_data_presenter_spec.rb index ca1d479a..0bb922fc 100644 --- a/spec/presenters/data_item_presenters/admin_data_presenter_spec.rb +++ b/spec/presenters/data_item_presenters/admin_data_presenter_spec.rb @@ -52,9 +52,9 @@ describe AdminDataPresenter do measure_id: measure_1A_i.measure_id, admin_data_items: measure_1A_i.admin_data_items, has_sufficient_data: true, school:, academic_year: ).descriptions_and_availability ).to eq [ - DataAvailability.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', true), - DataAvailability.new('a-exp-i2', 'Percentage teachers National Board certified', false), - DataAvailability.new('a-exp-i3', 'Percentage teachers teaching in area of licensure', false) + Summary.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', true), + Summary.new('a-exp-i2', 'Percentage teachers National Board certified', false), + Summary.new('a-exp-i3', 'Percentage teachers teaching in area of licensure', false) ] end end @@ -65,9 +65,9 @@ describe AdminDataPresenter do measure_id: measure_1A_i.measure_id, admin_data_items: measure_1A_i.admin_data_items, has_sufficient_data: true, school:, academic_year: ).descriptions_and_availability ).to eq [ - DataAvailability.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', false), - DataAvailability.new('a-exp-i2', 'Percentage teachers National Board certified', false), - DataAvailability.new('a-exp-i3', 'Percentage teachers teaching in area of licensure', false) + Summary.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', false), + Summary.new('a-exp-i2', 'Percentage teachers National Board certified', false), + Summary.new('a-exp-i3', 'Percentage teachers teaching in area of licensure', false) ] end end diff --git a/spec/presenters/data_item_presenters/student_survey_presenter.rb b/spec/presenters/data_item_presenters/student_survey_presenter.rb index 838ed6c4..b410048b 100644 --- a/spec/presenters/data_item_presenters/student_survey_presenter.rb +++ b/spec/presenters/data_item_presenters/student_survey_presenter.rb @@ -38,10 +38,10 @@ describe StudentSurveyPresenter do expect( result ).to eq [ - DataAvailability.new('s-sbel-q1', - 'I am happy when I am in class.', true), - DataAvailability.new('s-sbel-q2', - 'My teacher gives me help when I need it.', true) + Summary.new('s-sbel-q1', + 'I am happy when I am in class.', true), + Summary.new('s-sbel-q2', + 'My teacher gives me help when I need it.', true) ] end end diff --git a/spec/presenters/data_item_presenters/teacher_survey_presenter_spec.rb b/spec/presenters/data_item_presenters/teacher_survey_presenter_spec.rb index a332df05..f85fa00d 100644 --- a/spec/presenters/data_item_presenters/teacher_survey_presenter_spec.rb +++ b/spec/presenters/data_item_presenters/teacher_survey_presenter_spec.rb @@ -44,12 +44,12 @@ describe TeacherSurveyPresenter do academic_year: ).descriptions_and_availability ).to eq [ - DataAvailability.new('t-1', - 'Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?', true), - DataAvailability.new('t-2', - 'How prepared are you for teaching the topics that you are expected to teach in your assignment?', true), - DataAvailability.new('t-3', - 'How confident are you in working with the student body at your school?', true) + Summary.new('t-1', + 'Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?', true), + Summary.new('t-2', + 'How prepared are you for teaching the topics that you are expected to teach in your assignment?', true), + Summary.new('t-3', + 'How confident are you in working with the student body at your school?', true) ] end end @@ -64,7 +64,7 @@ describe TeacherSurveyPresenter do academic_year: ).descriptions_and_availability ).to eq [ - DataAvailability.new('1B-i', 'Items available upon request to Lowell Public Schools.', true) + Summary.new('1B-i', 'Items available upon request to Lowell Public Schools', true) ] end end