mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
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:
parent
8816fb5ebb
commit
b5badfaef5
10 changed files with 272 additions and 17 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue