Browse Source

handle prevtenbuy2 for bulk upload sales 2023

pull/1603/head
Phil Lee 2 years ago
parent
commit
1266212151
  1. 10
      app/services/bulk_upload/sales/year2023/row_parser.rb
  2. 8
      spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

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

@ -407,6 +407,15 @@ class BulkUpload::Sales::Year2023::RowParser
private
def prevtenbuy2
case field_72
when "R"
0
else
field_72
end
end
def infer_buyer2_ethnic_group_from_ethnic
case field_40
when 1, 2, 3, 18
@ -757,6 +766,7 @@ private
attributes["nationalbuy2"] = field_41
attributes["buy2living"] = field_71
attributes["prevtenbuy2"] = prevtenbuy2
attributes
end

8
spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

@ -659,5 +659,13 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
expect(parser.log.buy2living).to be(1)
end
end
describe "#prevtenbuy2" do
let(:attributes) { setup_section_params.merge({ field_72: "R" }) }
it "is correctly set" do
expect(parser.log.prevtenbuy2).to be(0)
end
end
end
end

Loading…
Cancel
Save