mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-10 07:50:33 -07:00
update tasks so that data gets loaded from sftp. Add task to delete 2016-17, and 2017-18 data
This commit is contained in:
parent
cf2b2433e9
commit
14570b3c33
2 changed files with 39 additions and 38 deletions
|
|
@ -45,7 +45,7 @@ namespace :one_off do
|
|||
filepath = Rails.root.join('data', 'survey_responses',
|
||||
'2021-22_revere_somerville_wareham_student_survey_responses.csv')
|
||||
puts "=====================> Loading data from csv at path: #{filepath}"
|
||||
SurveyResponsesDataLoader.load_data filepath: filepath
|
||||
SurveyResponsesDataLoader.load_data(filepath:)
|
||||
puts "=====================> Completed loading #{SurveyItemResponse.count} survey responses"
|
||||
puts 'Resetting response rates'
|
||||
ResponseRateLoader.reset
|
||||
|
|
@ -137,4 +137,12 @@ namespace :one_off do
|
|||
end
|
||||
puts values
|
||||
end
|
||||
|
||||
desc 'delete survey item responses for 2016-2017'
|
||||
task delete_survey_item_responses_2016_17: :environment do
|
||||
academic_years = AcademicYear.where(range: %w[2016-17 2017-18])
|
||||
response_count = SurveyItemResponse.where(academic_year: academic_years).count
|
||||
SurveyItemResponse.where(academic_year: academic_years).delete_all
|
||||
puts "Deleted #{response_count} survey item responses"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue