mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Correctly iterate over SurveyItemResponses when deduping schools
This commit is contained in:
parent
8a49178311
commit
4b4a437fa6
1 changed files with 4 additions and 2 deletions
|
|
@ -30,8 +30,10 @@ namespace :dupes do
|
|||
|
||||
school_to_keep.update(qualtrics_code: school_to_destroy.qualtrics_code)
|
||||
|
||||
SurveyItemResponse.where(school: school_to_destroy) do |response|
|
||||
response.update(school: school_to_keep)
|
||||
SurveyItemResponse.where(school: school_to_destroy).each do |response|
|
||||
success = response.update(school: school_to_keep)
|
||||
puts "Attempted to update survey item response with id #{response.id} to point to school with id #{school_to_keep.id}. Successful? #{success}"
|
||||
puts response.reload.school_id
|
||||
end
|
||||
|
||||
school_to_destroy.destroy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue