Browse Source

feat: add validation to check UPRN exists if address doesn't

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

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

@ -334,6 +334,8 @@ class BulkUpload::Lettings::Year2023::RowParser
validate :validate_valid_radio_option, on: :before_log
validate :validate_uprn_exists_if_address_does_not
def self.question_for_field(field)
QUESTIONS[field]
end
@ -431,6 +433,12 @@ private
@created_by ||= User.find_by(email: field_3)
end
def validate_uprn_exists_if_address_does_not
if field_18.blank? && field_19.blank? && field_21.blank?
errors.add(:field_18, I18n.t("validations.not_answered", question: "UPRN known"))
end
end
def validate_needs_type_present
if field_4.blank?
errors.add(:field_4, I18n.t("validations.not_answered", question: "needs type"))

Loading…
Cancel
Save