mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
more error handling
This commit is contained in:
parent
ae5d2ede98
commit
15eba2c9fc
1 changed files with 8 additions and 3 deletions
|
|
@ -218,7 +218,12 @@ namespace :data do
|
|||
key = key.gsub(/[[:space:]]/, ' ').strip.gsub(/\s+/, ' ')
|
||||
value = value.gsub(/[[:space:]]/, ' ').strip.downcase
|
||||
|
||||
question = Question.find_by_text(key)
|
||||
begin
|
||||
question = Question.find_by_text(key)
|
||||
rescue Exception => e
|
||||
puts "DATAERROR: Failed finding question: #{key} -> #{e}"
|
||||
end
|
||||
|
||||
if question.nil?
|
||||
next if missing_questions[key]
|
||||
puts "DATAERROR: Unable to find question: #{key}"
|
||||
|
|
@ -249,8 +254,8 @@ namespace :data do
|
|||
responded_at = Date.strptime(row['End Date'], '%m/%d/%Y %H:%M')
|
||||
begin
|
||||
recipient.attempts.create(question: question, answer_index: answer_index, responded_at: responded_at)
|
||||
rescue
|
||||
puts "DATAERROR: Attempt failed for #{recipient} -> QUESTION: #{question}, ANSWER_INDEX: #{answer_index}, RESPONDED_AT: #{responded_at}"
|
||||
rescue Exception => e
|
||||
puts "DATAERROR: Attempt failed for #{recipient} -> QUESTION: #{question}, ANSWER_INDEX: #{answer_index}, RESPONDED_AT: #{responded_at}, ERROR: #{e}"
|
||||
next
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue