Browse Source

Set proplen_asked based on proplen answer for 23/24 (#1630)

pull/1629/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
2ffa2d632b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/services/bulk_upload/sales/year2023/row_parser.rb
  2. 36
      spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

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

@ -806,7 +806,8 @@ private
attributes["mortlen"] = mortlen attributes["mortlen"] = mortlen
attributes["proplen"] = proplen attributes["proplen"] = proplen if proplen&.positive?
attributes["proplen_asked"] = attributes["proplen"]&.present? ? 0 : 1
attributes["jointmore"] = field_15 attributes["jointmore"] = field_15
attributes["staircase"] = field_87 attributes["staircase"] = field_87
attributes["privacynotice"] = field_29 attributes["privacynotice"] = field_29

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

@ -789,5 +789,41 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
expect(parser.log.soctenant).to be(1) expect(parser.log.soctenant).to be(1)
end end
end end
describe "with living before purchase years for shared ownership more than 0" do
let(:attributes) { setup_section_params.merge({ field_7: "1", field_86: "1" }) }
it "is sets living before purchase asked to yes and sets the correct living before purchase years" do
expect(parser.log.proplen_asked).to be(0)
expect(parser.log.proplen).to be(1)
end
end
describe "with living before purchase years for discounted ownership more than 0" do
let(:attributes) { setup_section_params.merge({ field_7: "2", field_115: "1" }) }
it "is sets living before purchase asked to yes and sets the correct living before purchase years" do
expect(parser.log.proplen_asked).to be(0)
expect(parser.log.proplen).to be(1)
end
end
describe "with living before purchase years for shared ownership set to 0" do
let(:attributes) { setup_section_params.merge({ field_7: "1", field_86: "0" }) }
it "is sets living before purchase asked to no" do
expect(parser.log.proplen_asked).to be(1)
expect(parser.log.proplen).to be_nil
end
end
describe "with living before purchase 0 years for discounted ownership set to 0" do
let(:attributes) { setup_section_params.merge({ field_7: "2", field_115: "0" }) }
it "is sets living before purchase asked to no" do
expect(parser.log.proplen_asked).to be(1)
expect(parser.log.proplen).to be_nil
end
end
end end
end end

Loading…
Cancel
Save