Browse Source

populate purchaser_code for bulk upload errors

- when log type is sales
pull/1091/head
Phil Lee 3 years ago
parent
commit
0de38b15e2
  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!(
field: error.attribute,
error: error.type,
purchaser_code: row_parser.field_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
}.to change(BulkUploadError, :count).by(1)
end
it "populates purchaser_code" do
validator.call
error = BulkUploadError.last
expect(error.purchaser_code).to eql("1")
end
end
end

Loading…
Cancel
Save