Browse Source

only annotate errors to the other fields if there was an error

CLDC-3987-Bug-fix-support-charge-validation
Samuel 3 days ago
parent
commit
e41d69feeb
  1. 3
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 3
      app/services/bulk_upload/lettings/year2025/row_parser.rb

3
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -945,10 +945,13 @@ private
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.charges.missing_charges", sentence_fragment: charge))
end
# if there were any errors, add an error to all the remaining present charges to make this entire section invalid
if blank_charge_fields.any?
other_charge_fields.each_key do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.charges.related_to_missing_charge"))
end
end
end
def all_charges_given?
field_125.present? && field_126.present? && field_127.present? && field_128.present?

3
app/services/bulk_upload/lettings/year2025/row_parser.rb

@ -944,10 +944,13 @@ private
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.charges.missing_charges", sentence_fragment: charge))
end
# if there were any errors, add an error to all the remaining present charges to make this entire section invalid
if blank_charge_fields.any?
other_charge_fields.each_key do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.charges.related_to_missing_charge"))
end
end
end
def all_charges_given?
field_124.present? && field_125.present? && field_126.present? && field_127.present?

Loading…
Cancel
Save