|
|
|
@ -1035,6 +1035,14 @@ private |
|
|
|
|
|
|
|
|
|
|
|
def add_errors_for_invalid_fields |
|
|
|
def add_errors_for_invalid_fields |
|
|
|
invalid_fields.each do |field| |
|
|
|
invalid_fields.each do |field| |
|
|
|
|
|
|
|
# ensure questions not routed to are not included in error report |
|
|
|
|
|
|
|
error_questions_ids = field_mapping_for_errors |
|
|
|
|
|
|
|
.select { |_k, fields| fields.map(&:to_s).include?(field.to_s) } |
|
|
|
|
|
|
|
.keys |
|
|
|
|
|
|
|
.map(&:to_s) |
|
|
|
|
|
|
|
error_questions = questions.select { |question| error_questions_ids.include?(question.id) } |
|
|
|
|
|
|
|
next if error_questions.none? { |question| question.page.routed_to?(log, nil) } |
|
|
|
|
|
|
|
|
|
|
|
errors.delete(field) # take precedence over any other errors as this is a BU format issue |
|
|
|
errors.delete(field) # take precedence over any other errors as this is a BU format issue |
|
|
|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: QUESTIONS[field.to_sym])) |
|
|
|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: QUESTIONS[field.to_sym])) |
|
|
|
end |
|
|
|
end |
|
|
|
|