Browse Source

CLDC-3330: Use partial postcodes in bulk upload (#2692)

* CLDC-3330: Use partial postcodes in bulk upload

* Adjust key address fields provided validations

* Use join to only insert space when both parts of postcode are provided
pull/2709/head^2 v0.4.81
Rachael Booth 3 months ago committed by GitHub
parent
commit
2974bcddd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 4
      app/services/bulk_upload/sales/year2024/row_parser.rb
  3. 8
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

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

@ -618,7 +618,7 @@ private
end
def key_address_fields_provided?
field_17.present? && field_19.present? && field_21.present? && field_22.present?
field_17.present? && field_19.present? && postcode_full.present?
end
def validate_address_fields
@ -1355,7 +1355,7 @@ private
end
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
def owning_organisation

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

@ -616,7 +616,7 @@ private
end
def key_address_fields_provided?
field_23.present? && field_25.present? && field_27.present? && field_28.present?
field_23.present? && field_25.present? && postcode_full.present?
end
def validate_address_fields
@ -1074,7 +1074,7 @@ private
end
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
def ppostcode_full

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

@ -2718,6 +2718,14 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "strips whitespace" do
expect(parser.log.postcode_full).to eql("EC1N 2TD")
end
context "when a partial postcode is provided" do
let(:attributes) { { bulk_upload:, field_4: 1, field_21: "EC1N", field_22: "" } }
it "is set to the partial value" do
expect(parser.log.postcode_full).to eql("EC1N")
end
end
end
describe "#la" do

Loading…
Cancel
Save