From 62dd58c0365f58653b131b954297b19d47660f4d Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Tue, 14 Feb 2023 17:52:01 +0000 Subject: [PATCH] feat: don't create logs in validator if any logs already exist --- app/services/bulk_upload/lettings/validator.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/services/bulk_upload/lettings/validator.rb b/app/services/bulk_upload/lettings/validator.rb index 6f37c0f3a..96937f687 100644 --- a/app/services/bulk_upload/lettings/validator.rb +++ b/app/services/bulk_upload/lettings/validator.rb @@ -176,6 +176,7 @@ class BulkUpload::Lettings::Validator def create_logs? return false if any_setup_sections_incomplete? return false if over_column_error_threshold? + return false if any_logs_already_exist? row_parsers.all? { |row_parser| row_parser.log.valid? } end @@ -203,6 +204,10 @@ private end end + def any_logs_already_exist? + row_parsers.any? { |row_parser| row_parser.log_already_exists? } + end + def csv_parser @csv_parser ||= BulkUpload::Lettings::CsvParser.new(path:) end