Browse Source

fix: add .presence to question.header and remove & before .downcase

pull/1524/head
Sam Seed 3 years ago
parent
commit
44bd2363d1
  1. 8
      app/services/bulk_upload/lettings/year2023/row_parser.rb

8
app/services/bulk_upload/lettings/year2023/row_parser.rb

@ -542,15 +542,15 @@ private
if setup_question?(question)
fields.each do |field|
if errors[field].present?
question_text = question.check_answer_label.presence || question.header || "this question"
errors.add(field, I18n.t("validations.not_answered", question: question_text&.downcase), category: :setup)
question_text = question.check_answer_label.presence || question.header.presence || "this question"
errors.add(field, I18n.t("validations.not_answered", question: question_text.downcase), category: :setup)
end
end
else
fields.each do |field|
unless errors.any? { |e| fields.include?(e.attribute) }
question_text = question.check_answer_label.presence || question.header || "this question"
errors.add(field, I18n.t("validations.not_answered", question: question_text&.downcase))
question_text = question.check_answer_label.presence || question.header.presence || "this question"
errors.add(field, I18n.t("validations.not_answered", question: question_text.downcase))
end
end
end

Loading…
Cancel
Save