diff --git a/app/models/form/lettings/pages/address_selection.rb b/app/models/form/lettings/pages/address_selection.rb index 962246df0..40a48c27b 100644 --- a/app/models/form/lettings/pages/address_selection.rb +++ b/app/models/form/lettings/pages/address_selection.rb @@ -12,7 +12,7 @@ class Form::Lettings::Pages::AddressSelection < ::Form::Page end def routed_to?(log, _current_user = nil) - log.uprn_known.present? && log.uprn_known.zero? && log.address_line1.present? && log.postcode_full.present? + log.uprn_known.present? && log.uprn_known.zero? && log.address_line1_input.present? && log.postcode_full_input.present? end def skip_text diff --git a/app/models/form/lettings/questions/address_line1_for_address_matcher.rb b/app/models/form/lettings/questions/address_line1_for_address_matcher.rb index 2c807f85b..fa9dbf98b 100644 --- a/app/models/form/lettings/questions/address_line1_for_address_matcher.rb +++ b/app/models/form/lettings/questions/address_line1_for_address_matcher.rb @@ -1,7 +1,7 @@ class Form::Lettings::Questions::AddressLine1ForAddressMatcher < ::Form::Question def initialize(id, hsh, page) super - @id = "address_line1" + @id = "address_line1_input" @header = "Address line 1" @error_label = "Address line 1" @type = "text" diff --git a/app/models/form/lettings/questions/postcode_for_address_matcher.rb b/app/models/form/lettings/questions/postcode_for_address_matcher.rb index 989b976c7..81387c233 100644 --- a/app/models/form/lettings/questions/postcode_for_address_matcher.rb +++ b/app/models/form/lettings/questions/postcode_for_address_matcher.rb @@ -1,7 +1,7 @@ class Form::Lettings::Questions::PostcodeForAddressMatcher < ::Form::Question def initialize(id, hsh, page) super - @id = "postcode_full" + @id = "postcode_full_input" @header = "Postcode" @type = "text" @width = 5 diff --git a/app/models/log.rb b/app/models/log.rb index 483ebfaed..1012f60ee 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -77,12 +77,12 @@ class Log < ApplicationRecord end def process_address_change! - if [address_selection, address_line1, postcode_full].all?(&:present?) - address_string = "#{address_line1}, , , #{postcode_full}" + if [address_selection, address_line1_input, postcode_full_input].all?(&:present?) + address_string = "#{address_line1_input}, , , #{postcode_full_input}" service = AddressClient.new(address_string) service.call - return errors.add(:address_line1, :address_error, message: service.error) if service.error.present? + return errors.add(:address_line1_input, :address_error, message: service.error) if service.error.present? if address_selection.between?(0, 9) presenter = AddressDataPresenter.new(service.result[address_selection]) @@ -109,12 +109,12 @@ class Log < ApplicationRecord end def address_options - if [address_line1, postcode_full].all?(&:present?) - address_string = "#{address_line1}, , , #{postcode_full}" + if [address_line1_input, postcode_full_input].all?(&:present?) + address_string = "#{address_line1_input}, , , #{postcode_full_input}" service = AddressClient.new(address_string) service.call - return errors.add(:address_line1, :address_error, message: service.error) if service.error.present? + return errors.add(:address_line1_input, :address_error, message: service.error) if service.error.present? address_options = [] service.result.first(10).each do |result| diff --git a/db/schema.rb b/db/schema.rb index b80b2fe56..0600c096f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_02_27_163853) do +ActiveRecord::Schema[7.0].define(version: 2024_03_04_103216) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -193,14 +193,14 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_27_163853) do t.integer "hb" t.integer "hbrentshortfall" t.integer "property_relet" - t.datetime "mrcdate" + t.datetime "mrcdate", precision: nil t.integer "incref" - t.datetime "startdate" + t.datetime "startdate", precision: nil t.integer "armedforces" t.integer "first_time_property_let_as_social_housing" t.integer "unitletas" t.integer "builtype" - t.datetime "voiddate" + t.datetime "voiddate", precision: nil t.bigint "owning_organisation_id" t.bigint "managing_organisation_id" t.integer "renttype" @@ -309,6 +309,8 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_27_163853) do t.integer "reasonother_value_check" t.integer "accessible_register" t.integer "address_selection" + t.string "address_line1_input" + t.string "postcode_full_input" t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id" t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id" t.index ["location_id"], name: "index_lettings_logs_on_location_id" @@ -713,8 +715,8 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_27_163853) do t.string "name" t.bigint "organisation_id" t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" + t.datetime "current_sign_in_at", precision: nil + t.datetime "last_sign_in_at", precision: nil t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.integer "role"