Browse Source

feat: don't create logs in validator if any logs already exist

cldc-1888-bulk-upload-duplicate-log-validation
Sam Seed 2 years ago
parent
commit
62dd58c036
  1. 5
      app/services/bulk_upload/lettings/validator.rb

5
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

Loading…
Cancel
Save