Add metadata for 2019-20 year. Finishes #181530277

pull/1/head
Nelson Jovel 4 years ago
parent 36da912253
commit 5a9e8a9b01

@ -63,6 +63,8 @@ class Seeder
academic_years.each do |academic_year|
total_students = row["Total Students for Response Rate (#{academic_year.range})"]
total_teachers = row["Total Teachers for Response Rate (#{academic_year.range})"]
total_students = remove_commas(total_students)
total_teachers = remove_commas(total_teachers)
respondent = Respondent.find_or_initialize_by school: school, academic_year: academic_year
respondent.total_students = total_students
respondent.total_teachers = total_teachers
@ -140,4 +142,8 @@ class Seeder
def marked?(mark)
mark.present? ? mark.upcase.strip == 'X' : false
end
def remove_commas(target)
target.gsub(',', '') if target.present?
end
end

@ -1,8 +1,6 @@
class TeacherResponseRate
include ResponseRate
private
def survey_item_count
@survey_item_count ||= @subcategory.measures.map { |measure| measure.teacher_survey_items.count }.sum
end

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
District,School Name,District Code,School Code,DESE School ID,HS?,Short Form Only (2020-21),School Closed In ,Total Students for Response Rate (2020-21),Total Teachers for Response Rate (2020-21),Total Students for Response Rate (2019-20),Total Teachers for Response Rate (2019-20)
Attleboro,A. Irvin Studley Elementary School,1,7,160001,,X,,75,26.9,76,26.9
Attleboro,Attleboro High School,1,1,160505,X,,,1792,114.7,1800,120
Attleboro,Attleboro High School,1,1,160505,X,,,"1,792",114.7,1800,120
Boston,Samuel Adams Elementary School,2,1,350302,,,,79,28.4,80,30

1 District School Name District Code School Code DESE School ID HS? Short Form Only (2020-21) School Closed In Total Students for Response Rate (2020-21) Total Teachers for Response Rate (2020-21) Total Students for Response Rate (2019-20) Total Teachers for Response Rate (2019-20)
2 Attleboro A. Irvin Studley Elementary School 1 7 160001 X 75 26.9 76 26.9
3 Attleboro Attleboro High School 1 1 160505 X 1792 1,792 114.7 1800 120
4 Boston Samuel Adams Elementary School 2 1 350302 79 28.4 80 30

@ -131,6 +131,13 @@ describe Seeder do
seeder.seed_respondents sample_districts_and_schools_csv
end.to change { Respondent.count }.by School.count
end
it 'seeds the total number of students and teachers even if the original number includes commas' do
seeder.seed_respondents sample_districts_and_schools_csv
school = School.find_by_name('Attleboro High School')
academic_year = AcademicYear.find_by_range('2020-21')
school_with_over_one_thousand_student_respondents = Respondent.where(school:, academic_year:).first
expect(school_with_over_one_thousand_student_respondents.total_students).to eq 1792
end
end
context 'surveys' do

Loading…
Cancel
Save