Rename DataAvailability to Summary

pull/1/head
rebuilt 3 years ago
parent 596ce25737
commit 541f29108b

@ -1,4 +0,0 @@
# frozen_string_literal: true
class DataAvailability < Struct.new(:id, :description, :available?)
end

@ -0,0 +1,4 @@
# frozen_string_literal: true
class Summary < Struct.new(:id, :description, :available?)
end

@ -60,6 +60,6 @@ class SurveyItem < ActiveRecord::Base
# TODO: rename this to Summary # TODO: rename this to Summary
def description def description
DataAvailability.new(survey_item_id, prompt, true) Summary.new(survey_item_id, prompt, true)
end end
end end

@ -20,7 +20,7 @@ class AdminDataPresenter < DataItemPresenter
def descriptions_and_availability def descriptions_and_availability
@admin_data_items.map do |admin_data_item| @admin_data_items.map do |admin_data_item|
DataAvailability.new(admin_data_item.admin_data_item_id, admin_data_item.description, 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) admin_data_item.admin_data_values.where(school:, academic_year:).count > 0)
end end
end end

@ -22,12 +22,12 @@ class TeacherSurveyPresenter < DataItemPresenter
def descriptions_and_availability def descriptions_and_availability
if @measure_id == '1B-i' if @measure_id == '1B-i'
return [DataAvailability.new('1B-i', 'Items available upon request to ECP', return [Summary.new('1B-i', 'Items available upon request to ECP',
true)] true)]
end end
survey_items.map do |survey_item| 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 end
end end

@ -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: 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 ).descriptions_and_availability
).to eq [ ).to eq [
DataAvailability.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', true), Summary.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', true),
DataAvailability.new('a-exp-i2', 'Percentage teachers National Board certified', false), Summary.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-i3', 'Percentage teachers teaching in area of licensure', false)
] ]
end end
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: 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 ).descriptions_and_availability
).to eq [ ).to eq [
DataAvailability.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', false), Summary.new('a-exp-i1', 'Percentage teachers with 5+ years of experience', false),
DataAvailability.new('a-exp-i2', 'Percentage teachers National Board certified', false), Summary.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-i3', 'Percentage teachers teaching in area of licensure', false)
] ]
end end
end end

@ -38,9 +38,9 @@ describe StudentSurveyPresenter do
expect( expect(
result result
).to eq [ ).to eq [
DataAvailability.new('s-sbel-q1', Summary.new('s-sbel-q1',
'I am happy when I am in class.', true), 'I am happy when I am in class.', true),
DataAvailability.new('s-sbel-q2', Summary.new('s-sbel-q2',
'My teacher gives me help when I need it.', true) 'My teacher gives me help when I need it.', true)
] ]
end end

@ -44,11 +44,11 @@ describe TeacherSurveyPresenter do
academic_year: academic_year:
).descriptions_and_availability ).descriptions_and_availability
).to eq [ ).to eq [
DataAvailability.new('t-1', Summary.new('t-1',
'Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?', true), 'Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?', true),
DataAvailability.new('t-2', Summary.new('t-2',
'How prepared are you for teaching the topics that you are expected to teach in your assignment?', true), 'How prepared are you for teaching the topics that you are expected to teach in your assignment?', true),
DataAvailability.new('t-3', Summary.new('t-3',
'How confident are you in working with the student body at your school?', true) '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: academic_year:
).descriptions_and_availability ).descriptions_and_availability
).to eq [ ).to eq [
DataAvailability.new('1B-i', 'Items available upon request to ECP', true) Summary.new('1B-i', 'Items available upon request to ECP', true)
] ]
end end
end end

Loading…
Cancel
Save