From d47d7cab717a62c6c40627650e42f54021e797cb Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Wed, 1 Mar 2023 12:22:16 +0000 Subject: [PATCH] persist bulk upload error category --- app/services/bulk_upload/lettings/validator.rb | 1 + spec/services/bulk_upload/lettings/validator_spec.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/app/services/bulk_upload/lettings/validator.rb b/app/services/bulk_upload/lettings/validator.rb index f6f6614cc..779f0315b 100644 --- a/app/services/bulk_upload/lettings/validator.rb +++ b/app/services/bulk_upload/lettings/validator.rb @@ -168,6 +168,7 @@ class BulkUpload::Lettings::Validator row:, cell: "#{cols[field_number_for_attribute(error.attribute) - col_offset + 1]}#{row}", col: cols[field_number_for_attribute(error.attribute) - col_offset + 1], + category: error.options[:category], ) end end diff --git a/spec/services/bulk_upload/lettings/validator_spec.rb b/spec/services/bulk_upload/lettings/validator_spec.rb index 0aaeaac78..ca52a19fe 100644 --- a/spec/services/bulk_upload/lettings/validator_spec.rb +++ b/spec/services/bulk_upload/lettings/validator_spec.rb @@ -51,6 +51,11 @@ RSpec.describe BulkUpload::Lettings::Validator do expect(error.row).to eql("7") expect(error.cell).to eql("L7") expect(error.col).to eql("L") + expect(error.category).to be_nil + + error = BulkUploadError.order(:row, :field).find_by(field: "field_111") + + expect(error.category).to eql("setup") end end