Browse Source

CLDC-3034 Fix bulk upload error on empty field bug (#2135)

* feat: don't add empty assignments in field_mapping_for_errors

* feat: use empty arrays

* feat: revert previous commit

* feat: add previously failing test
pull/2137/head v0.4.5
natdeanlewissoftwire 12 months ago committed by GitHub
parent
commit
6c044fd036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  2. 2
      config/locales/en.yml
  3. 18
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

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

@ -893,10 +893,10 @@ private
owning_organisation_id: [:field_1],
managing_organisation_id: [:field_2],
renewal: [:field_6],
scheme_id: [scheme_field],
scheme: [scheme_field],
location_id: [location_field],
location: [location_field],
scheme_id: (scheme_field.present? ? [scheme_field] : nil),
scheme: (scheme_field.present? ? [scheme_field] : nil),
location_id: (location_field.present? ? [location_field] : nil),
location: (location_field.present? ? [location_field] : nil),
created_by: [:field_3],
needstype: [:field_4],
rent_type: %i[field_5 field_10 field_11],
@ -1040,7 +1040,7 @@ private
address_line2: [:field_20],
town_or_city: [:field_21],
county: [:field_22],
}
}.compact
end
def attribute_set

2
config/locales/en.yml

@ -353,7 +353,7 @@ en:
financial:
tshortfall:
outstanding_amount_not_expected: "You cannot answer the outstanding amount question if you don’t have outstanding rent or charges"
more_than_rent: "Enter a value less less than the basic rent amount"
more_than_rent: "Enter a value less than the basic rent amount"
must_be_positive: "Enter a value over £0.01 as you told us there is an outstanding amount"
hbrentshortfall:
outstanding_amount_not_expected: "Answer must be ‘yes’ as you have answered the outstanding amount question"

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

@ -617,6 +617,24 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
end
end
context "when the rent range validation is triggered but the log has no scheme or location id" do
let(:attributes) do
setup_section_params.merge({ field_15: nil,
field_16: nil,
field_17: nil,
field_128: 300,
field_126: 1,
field_32: 1,
field_4: 1,
field_5: "3",
field_25: "E09000008" })
end
it "is not a valid row" do
expect(parser).not_to be_valid
end
end
context "when a hidden log already exists in db" do
before do
parser.log.status = "pending"

Loading…
Cancel
Save