From 5d31277beef02c6d73e29476e31edfdb563d2632 Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Thu, 20 Apr 2023 18:31:31 +0100 Subject: [PATCH] refactor: standardise check for presence of needs type --- app/services/bulk_upload/lettings/year2023/row_parser.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 69e996d69..284163ede 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -292,6 +292,7 @@ class BulkUpload::Lettings::Year2023::RowParser validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 7 must be a number or the letter R" }, allow_blank: true, on: :after_log validates :field_76, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 8 must be a number or the letter R" }, allow_blank: true, on: :after_log + validates :field_4, presence: { message: I18n.t("validations.not_answered", question: "needs type") }, on: :after_log validates :field_6, presence: { message: I18n.t("validations.not_answered", question: "property renewal") }, on: :after_log validates :field_7, presence: { message: I18n.t("validations.not_answered", question: "tenancy start date (day)") }, on: :after_log validates :field_8, presence: { message: I18n.t("validations.not_answered", question: "tenancy start date (month)") }, on: :after_log @@ -299,7 +300,6 @@ class BulkUpload::Lettings::Year2023::RowParser validates :field_9, format: { with: /\A\d{2}\z/, message: I18n.t("validations.setup.startdate.year_not_two_digits") }, on: :after_log - validate :validate_needs_type_present, on: :after_log validate :validate_data_types, on: :after_log validate :validate_nulls, on: :after_log validate :validate_relevant_collection_window, on: :after_log @@ -439,12 +439,6 @@ private end end - def validate_needs_type_present - if field_4.blank? - errors.add(:field_4, I18n.t("validations.not_answered", question: "needs type")) - end - end - def start_date return if field_7.blank? || field_8.blank? || field_9.blank?