diff --git a/app/services/bulk_upload/lettings/row_parser.rb b/app/services/bulk_upload/lettings/row_parser.rb index bf1f62eba..2acd82d99 100644 --- a/app/services/bulk_upload/lettings/row_parser.rb +++ b/app/services/bulk_upload/lettings/row_parser.rb @@ -150,6 +150,7 @@ class BulkUpload::Lettings::RowParser validate :validate_cannot_be_la_referral_if_general_needs validate :validate_leaving_reason_for_renewal validate :validate_lettings_type_matches_bulk_upload + validate :validate_if_log_already_exists validate :validate_only_one_housing_needs_type validate :validate_no_disabled_needs_conjunction validate :validate_dont_know_disabled_needs_conjunction @@ -292,6 +293,18 @@ private end end + def validate_if_log_already_exists + fields = { + "beds" => field_101, + "joint" => field_133, + } + duplicate_log_exists = LettingsLog.where(fields).present? + + if duplicate_log_exists + errors.add('test', "test") + end + end + def field_mapping_for_errors { lettype: [:field_1],