Browse Source

feat: update error message and fix tests

pull/2278/head
natdeanlewissoftwire 2 years ago
parent
commit
cd90b60fef
  1. 6
      app/models/lettings_log.rb
  2. 6
      app/models/sales_log.rb
  3. 2
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

6
app/models/lettings_log.rb

@ -858,6 +858,10 @@ private
return unless startdate return unless startdate
return unless form.start_year_after_2024? return unless form.start_year_after_2024?
uprn_selection_changed? || select_best_address_match || startdate_changed? if select_best_address_match
address_line1_input.present? && postcode_full_input.present?
else
uprn_selection_changed? || startdate_changed?
end
end end
end end

6
app/models/sales_log.rb

@ -442,7 +442,11 @@ class SalesLog < Log
return unless saledate return unless saledate
return unless form.start_year_after_2024? return unless form.start_year_after_2024?
uprn_selection_changed? || select_best_address_match || saledate_changed? if select_best_address_match
address_line1_input.present? && postcode_full_input.present?
else
uprn_selection_changed? || saledate_changed?
end
end end
def value_with_discount def value_with_discount

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

@ -1445,7 +1445,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
let(:attributes) { setup_section_params.merge({ field_16: "1234567890123" }) } let(:attributes) { setup_section_params.merge({ field_16: "1234567890123" }) }
it "adds an appropriate error" do it "adds an appropriate error" do
expect(parser.errors[:field_16]).to eql(["UPRN is not recognised. Check the number, or enter the address"]) expect(parser.errors[:field_16]).to eql(["UPRN must be 12 digits or less"])
end end
end end

Loading…
Cancel
Save