Browse Source

Set housingneeds other to no if any of the housing needs are given (#1812)

CLDC-2105-merge-orgs-owning-org-dropdown
kosiakkatrina 1 year ago committed by GitHub
parent
commit
6e8acbc927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/services/bulk_upload/lettings/year2022/row_parser.rb
  2. 1
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  3. 10
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb
  4. 10
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

1
app/services/bulk_upload/lettings/year2022/row_parser.rb

@ -1466,6 +1466,7 @@ private
def housingneeds_other
return 1 if field_58 == 1
return 0 if [field_55, field_56, field_57].include?(1)
end
def ethnic_group_from_ethnic

1
app/services/bulk_upload/lettings/year2023/row_parser.rb

@ -1410,6 +1410,7 @@ private
def housingneeds_other
return 1 if field_86 == 1
return 0 if [field_83, field_84, field_85].include?(1)
end
def prevloc

10
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -1914,6 +1914,16 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
expect(parser.log.housingneeds_other).to eq(1)
end
end
context "when field_58 is nil and one housingneeds option is selected" do
let(:attributes) { { bulk_upload:, field_58: nil, field_55: "1" } }
it "sets to 0" do
expect(parser.errors[:field_58]).to be_blank
expect(parser.errors[:field_55]).to be_blank
expect(parser.log.housingneeds_other).to eq(0)
end
end
end
end

10
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -754,6 +754,16 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
expect(parser.errors[:field_87]).to be_present
end
end
context "when one item selected and field_86 is blank" do
let(:attributes) { setup_section_params.merge({ field_83: "1", field_86: nil }) }
it "sets other disabled access needs as no" do
expect(parser.errors[:field_83]).to be_blank
expect(parser.errors[:field_86]).to be_blank
expect(parser.log.housingneeds_other).to eq(0)
end
end
end
describe "#field_89, field_98 - 99" do

Loading…
Cancel
Save