Browse Source

CLDC-3310 UPRN routing bug fix (#2312)

* feat: update routing

* feat: test routing
pull/2319/head
natdeanlewissoftwire 9 months ago committed by GitHub
parent
commit
5b5e29a84a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      app/models/form/lettings/pages/no_address_found.rb
  2. 4
      app/models/form/lettings/pages/property_local_authority.rb
  3. 6
      app/models/form/lettings/pages/uprn_selection.rb
  4. 7
      app/models/form/sales/pages/no_address_found.rb
  5. 6
      app/models/form/sales/pages/property_local_authority.rb
  6. 6
      app/models/form/sales/pages/uprn_selection.rb
  7. 4
      app/models/lettings_log.rb
  8. 4
      app/models/sales_log.rb
  9. 10
      spec/models/form/lettings/pages/no_address_found_spec.rb
  10. 4
      spec/models/form/lettings/pages/property_local_authority_spec.rb
  11. 10
      spec/models/form/lettings/pages/uprn_selection_spec.rb
  12. 4
      spec/models/form/sales/pages/no_address_found_spec.rb
  13. 4
      spec/models/form/sales/pages/property_local_authority_spec.rb
  14. 4
      spec/models/form/sales/pages/uprn_selection_spec.rb

6
app/models/form/lettings/pages/no_address_found.rb

@ -11,7 +11,11 @@ class Form::Lettings::Pages::NoAddressFound < ::Form::Page
"translation" => "soft_validations.no_address_found.informative_text", "translation" => "soft_validations.no_address_found.informative_text",
"arguments" => [], "arguments" => [],
} }
@depends_on = [{ "address_options_present?" => false }] @depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => false },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => false },
{ "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => false },
]
end end
def questions def questions

4
app/models/form/lettings/pages/property_local_authority.rb

@ -2,7 +2,9 @@ class Form::Lettings::Pages::PropertyLocalAuthority < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "property_local_authority" @id = "property_local_authority"
@depends_on = [{ "is_la_inferred" => false, "is_general_needs?" => true }] @depends_on = [
{ "is_la_inferred" => false, "is_general_needs?" => true, "address_search_given?" => true },
]
end end
def questions def questions

6
app/models/form/lettings/pages/uprn_selection.rb

@ -3,7 +3,11 @@ class Form::Lettings::Pages::UprnSelection < ::Form::Page
super super
@id = "uprn_selection" @id = "uprn_selection"
@header = "We found some addresses that might be this property" @header = "We found some addresses that might be this property"
@depends_on = [{ "address_options_present?" => true }] @depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => true },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => true },
{ "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => true },
]
end end
def questions def questions

7
app/models/form/sales/pages/no_address_found.rb

@ -11,7 +11,12 @@ class Form::Sales::Pages::NoAddressFound < ::Form::Page
"translation" => "soft_validations.no_address_found.informative_text", "translation" => "soft_validations.no_address_found.informative_text",
"arguments" => [], "arguments" => [],
} }
@depends_on = [{ "address_options_present?" => false }] @depends_on = [
{ "uprn_known" => nil, "address_options_present?" => false },
{ "uprn_known" => 0, "address_options_present?" => false },
{ "uprn_confirmed" => 0, "address_options_present?" => false },
]
end end
def questions def questions

6
app/models/form/sales/pages/property_local_authority.rb

@ -2,9 +2,9 @@ class Form::Sales::Pages::PropertyLocalAuthority < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "property_local_authority" @id = "property_local_authority"
@depends_on = [{ @depends_on = [
"is_la_inferred" => false, { "is_la_inferred" => false, "address_search_given?" => true },
}] ]
end end
def questions def questions

6
app/models/form/sales/pages/uprn_selection.rb

@ -3,7 +3,11 @@ class Form::Sales::Pages::UprnSelection < ::Form::Page
super super
@id = "uprn_selection" @id = "uprn_selection"
@header = "We found some addresses that might be this property" @header = "We found some addresses that might be this property"
@depends_on = [{ "address_options_present?" => true }] @depends_on = [
{ "uprn_known" => nil, "address_options_present?" => true },
{ "uprn_known" => 0, "address_options_present?" => true },
{ "uprn_confirmed" => 0, "address_options_present?" => true },
]
end end
def questions def questions

4
app/models/lettings_log.rb

@ -694,6 +694,10 @@ class LettingsLog < Log
LettingsLog.where.not(duplicate_set_id: nil).where(duplicate_set_id:).where.not(id:) LettingsLog.where.not(duplicate_set_id: nil).where(duplicate_set_id:).where.not(id:)
end end
def address_search_given?
address_line1_input.present? && postcode_full.present?
end
private private
def reset_invalid_unresolved_log_fields! def reset_invalid_unresolved_log_fields!

4
app/models/sales_log.rb

@ -530,4 +530,8 @@ class SalesLog < Log
def stairowned_100? def stairowned_100?
stairowned == 100 stairowned == 100
end end
def address_search_given?
address_line1_input.present? && postcode_full.present?
end
end end

10
spec/models/form/lettings/pages/no_address_found_spec.rb

@ -25,7 +25,15 @@ RSpec.describe Form::Lettings::Pages::NoAddressFound, type: :model do
end end
it "has correct depends_on" do it "has correct depends_on" do
expect(page.depends_on).to eq([{ "address_options_present?" => false }]) expect(page.depends_on).to eq([{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_known" => nil },
{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_known" => 0 },
{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_confirmed" => 0 }])
end end
it "is interruption screen page" do it "is interruption screen page" do

4
spec/models/form/lettings/pages/property_local_authority_spec.rb

@ -33,6 +33,8 @@ RSpec.describe Form::Lettings::Pages::PropertyLocalAuthority, type: :model do
end end
it "has the correct depends_on" do it "has the correct depends_on" do
expect(page.depends_on).to match([{ "is_general_needs?" => true, "is_la_inferred" => false }]) expect(page.depends_on).to match([{ "address_search_given?" => true,
"is_general_needs?" => true,
"is_la_inferred" => false }])
end end
end end

10
spec/models/form/lettings/pages/uprn_selection_spec.rb

@ -39,6 +39,14 @@ RSpec.describe Form::Lettings::Pages::UprnSelection, type: :model do
end end
it "has correct depends_on" do it "has correct depends_on" do
expect(page.depends_on).to eq([{ "address_options_present?" => true }]) expect(page.depends_on).to eq([{ "address_options_present?" => true,
"is_supported_housing?" => false,
"uprn_known" => nil },
{ "address_options_present?" => true,
"is_supported_housing?" => false,
"uprn_known" => 0 },
{ "address_options_present?" => true,
"is_supported_housing?" => false,
"uprn_confirmed" => 0 }])
end end
end end

4
spec/models/form/sales/pages/no_address_found_spec.rb

@ -25,7 +25,9 @@ RSpec.describe Form::Sales::Pages::NoAddressFound, type: :model do
end end
it "has correct depends_on" do it "has correct depends_on" do
expect(page.depends_on).to eq([{ "address_options_present?" => false }]) expect(page.depends_on).to eq([{ "address_options_present?" => false, "uprn_known" => nil },
{ "address_options_present?" => false, "uprn_known" => 0 },
{ "address_options_present?" => false, "uprn_confirmed" => 0 }])
end end
it "is interruption screen page" do it "is interruption screen page" do

4
spec/models/form/sales/pages/property_local_authority_spec.rb

@ -52,8 +52,6 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do
end end
it "has the correct depends_on" do it "has the correct depends_on" do
expect(page.depends_on).to eq([{ expect(page.depends_on).to eq([{ "address_search_given?" => true, "is_la_inferred" => false }])
"is_la_inferred" => false,
}])
end end
end end

4
spec/models/form/sales/pages/uprn_selection_spec.rb

@ -39,6 +39,8 @@ RSpec.describe Form::Sales::Pages::UprnSelection, type: :model do
end end
it "has correct depends_on" do it "has correct depends_on" do
expect(page.depends_on).to eq([{ "address_options_present?" => true }]) expect(page.depends_on).to eq([{ "address_options_present?" => true, "uprn_known" => nil },
{ "address_options_present?" => true, "uprn_known" => 0 },
{ "address_options_present?" => true, "uprn_confirmed" => 0 }])
end end
end end

Loading…
Cancel
Save