Browse Source

map net_income_known correctly for bulk upload

remotes/origin/bulk-upload-errors-integration
Phil Lee 3 years ago
parent
commit
77e88f4118
  1. 15
      app/services/bulk_upload/lettings/row_parser.rb
  2. 8
      spec/services/bulk_upload/lettings/row_parser_spec.rb

15
app/services/bulk_upload/lettings/row_parser.rb

@ -478,7 +478,7 @@ private
attributes["referral"] = field_78 attributes["referral"] = field_78
attributes["net_income_known"] = field_51 attributes["net_income_known"] = net_income_known
attributes["hb"] = field_48 attributes["hb"] = field_48
attributes["benefits"] = field_49 attributes["benefits"] = field_49
@ -493,6 +493,19 @@ private
attributes attributes
end end
def net_income_known
case field_51
when 1
0
when 2
1
when 3
1
when 4
2
end
end
def leftreg def leftreg
case field_114 case field_114
when 3 when 3

8
spec/services/bulk_upload/lettings/row_parser_spec.rb

@ -448,5 +448,13 @@ RSpec.describe BulkUpload::Lettings::RowParser do
expect(parser.log.relat8).to eq("X") expect(parser.log.relat8).to eq("X")
end end
end end
describe "#net_income_known" do
let(:attributes) { { bulk_upload:, field_51: "1" } }
it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(0)
end
end
end end
end end

Loading…
Cancel
Save