Browse Source

feat: assign purchaser_code for each year

pull/1638/head
natdeanlewissoftwire 3 years ago
parent
commit
82368906cf
  1. 2
      app/services/bulk_upload/sales/validator.rb
  2. 6
      app/services/bulk_upload/sales/year2022/row_parser.rb
  3. 8
      app/services/bulk_upload/sales/year2023/row_parser.rb

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

@ -23,7 +23,7 @@ class BulkUpload::Sales::Validator
bulk_upload.bulk_upload_errors.create!(
field: error.attribute,
error: error.message,
purchaser_code: row_parser.field_1,
purchaser_code: row_parser.purchaser_code,
row:,
cell: "#{col}#{row}",
col:,

6
app/services/bulk_upload/sales/year2022/row_parser.rb

@ -344,6 +344,10 @@ class BulkUpload::Sales::Year2022::RowParser
.exists?(duplicate_check_fields.index_with { |field| log.public_send(field) })
end
def purchaser_code
field_1
end
private
def buyer_not_interviewed?
@ -487,7 +491,7 @@ private
def attributes_for_log
attributes = {}
attributes["purchid"] = field_1
attributes["purchid"] = purchaser_code
attributes["saledate"] = saledate
attributes["noint"] = field_6

8
app/services/bulk_upload/sales/year2023/row_parser.rb

@ -473,7 +473,11 @@ class BulkUpload::Sales::Year2023::RowParser
.exists?(duplicate_check_fields.index_with { |field| log.public_send(field) })
end
private
def purchaser_code
field_6
end
private
def prevtenbuy2
case field_72
@ -695,7 +699,7 @@ private
def attributes_for_log
attributes = {}
attributes["purchid"] = field_6
attributes["purchid"] = purchaser_code
attributes["saledate"] = saledate
attributes["noint"] = 2 if field_28 == 1

Loading…
Cancel
Save