diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index af82fe6d4..d6215725a 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -750,13 +750,18 @@ private end def validate_reasonable_preference_dont_know + other_reason_fields = %i[field_107 field_108 field_109 field_110] if field_106 == 1 - selected_reasons = [field_107, field_108, field_109, field_110].count(1) + selected_reasons = other_reason_fields.select { |field| send(field) == 1 } dont_know_selected = field_111 == 1 - if selected_reasons.positive? && dont_know_selected + if selected_reasons.any? && dont_know_selected block_log_creation! - errors.add(:field_111, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict")) + + errors.add(:field_111, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.dont_know")) + selected_reasons.each do |field| + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.other")) + end end end end diff --git a/config/locales/validations/lettings/2024/bulk_upload.en.yml b/config/locales/validations/lettings/2024/bulk_upload.en.yml index b41c49a23..7431b074a 100644 --- a/config/locales/validations/lettings/2024/bulk_upload.en.yml +++ b/config/locales/validations/lettings/2024/bulk_upload.en.yml @@ -59,4 +59,6 @@ en: charges: missing_charges: "Please enter the %{sentence_fragment}. If there is no %{sentence_fragment}, please enter '0'." reasonpref: - conflict: "You cannot select 'Don't know' if any of the other reasonable preference reasons are also selected." + conflict: + dont_know: "You cannot select 'Don't know' if any of the other reasonable preference reasons are also selected." + other: "You cannot select this reasonable preference reason as you've also selected 'Don't know' as a reason."