Browse Source

populate purchaser_code for bulk upload errors

- when log type is sales
remotes/origin/bulk-upload-errors-integration
Phil Lee 3 years ago
parent
commit
6cdd852f1b
  1. 1
      app/services/bulk_upload/sales/validator.rb
  2. 7
      spec/services/bulk_upload/sales/validator_spec.rb

1
app/services/bulk_upload/sales/validator.rb

@ -153,6 +153,7 @@ class BulkUpload::Sales::Validator
bulk_upload.bulk_upload_errors.create!( bulk_upload.bulk_upload_errors.create!(
field: error.attribute, field: error.attribute,
error: error.type, error: error.type,
purchaser_code: row_parser.field_1,
row:, row:,
cell: "#{cols[field_number_for_attribute(error.attribute) + col_offset - 1]}#{row}", cell: "#{cols[field_number_for_attribute(error.attribute) + col_offset - 1]}#{row}",
) )

7
spec/services/bulk_upload/sales/validator_spec.rb

@ -36,5 +36,12 @@ RSpec.describe BulkUpload::Sales::Validator do
validator.call validator.call
}.to change(BulkUploadError, :count).by(1) }.to change(BulkUploadError, :count).by(1)
end end
it "populates purchaser_code" do
validator.call
error = BulkUploadError.last
expect(error.purchaser_code).to eql("1")
end
end end
end end

Loading…
Cancel
Save