Browse Source

Use join to only insert space when both parts of postcode are provided

pull/2692/head
Rachael Booth 2 years ago
parent
commit
0a636e374b
  1. 2
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 2
      app/services/bulk_upload/sales/year2024/row_parser.rb
  3. 2
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

2
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -1355,7 +1355,7 @@ private
end end
def postcode_full def postcode_full
"#{field_21} #{field_22}" if field_21 || field_22 [field_21, field_22].compact_blank.join(" ") if field_21 || field_22
end end
def owning_organisation def owning_organisation

2
app/services/bulk_upload/sales/year2024/row_parser.rb

@ -1074,7 +1074,7 @@ private
end end
def postcode_full def postcode_full
"#{field_27} #{field_28}" if field_27 || field_28 [field_27, field_28].compact_blank.join(" ") if field_27 || field_28
end end
def ppostcode_full def ppostcode_full

2
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -2720,7 +2720,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
end end
context "when a partial postcode is provided" do context "when a partial postcode is provided" do
let(:attributes) { { bulk_upload:, field_4: 1, field_21: "EC1N", field_22: nil } } let(:attributes) { { bulk_upload:, field_4: 1, field_21: "EC1N", field_22: "" } }
it "is set to the partial value" do it "is set to the partial value" do
expect(parser.log.postcode_full).to eql("EC1N") expect(parser.log.postcode_full).to eql("EC1N")

Loading…
Cancel
Save