Add DESE ID to schools

- Add migration
- Create one-off script `rake one_off:add_dese_ids` to add the DESE ID to schools
- Update seeder to seed schools based on DESE IDs
This commit is contained in:
rebuilt 2021-11-18 19:41:03 +01:00 committed by Liam Morley
parent 8816fb5ebb
commit b5badfaef5
10 changed files with 272 additions and 17 deletions

View file

@ -11,14 +11,17 @@ class Seeder
CSV.parse(File.read(csv_file), headers: true) do |row|
district_name = row['District'].strip
district_code = row['District Code'].strip
dese_id = row['DESE School ID'].strip
school_name = row['School Name'].strip
school_code = row['School Code'].strip
district = District.find_or_create_by! name: district_name
district.update! slug: district_name.parameterize, qualtrics_code: district_code
school = School.find_or_create_by! name: school_name, district: district
school.update! qualtrics_code: school_code
school = School.find_or_initialize_by dese_id: dese_id, district: district
school.name = school_name
school.qualtrics_code = school_code
school.save!
end
end