mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
Add a way to delete non-lowell schools and districts
This commit is contained in:
parent
69179ce157
commit
0500d7c93f
1 changed files with 10 additions and 0 deletions
|
|
@ -69,6 +69,16 @@ namespace :data do
|
|||
Rails.cache.clear
|
||||
end
|
||||
|
||||
desc 'delete non-lowell schools and districts'
|
||||
task delete_non_lowell: :environment do
|
||||
schools = School.all.reject { |s| s.district.name == 'Lowell' }
|
||||
Respondent.where(school: schools).delete_all
|
||||
Survey.where(school: schools).delete_all
|
||||
schools.each { |school| school.delete }
|
||||
districts = District.all.reject { |district| district.name == 'Lowell' }
|
||||
districts.each { |district| district.delete }
|
||||
end
|
||||
|
||||
task load_survey_responses_21_22: :environment do
|
||||
Dir.glob(Rails.root.join('data', 'survey_responses', '*2021-22*.csv')).each do |filepath|
|
||||
puts "=====================> Loading data from csv at path: #{filepath}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue