|
|
|
module DerivedVariables::SalesLogVariables
|
|
|
|
include DerivedVariables::SharedLogic
|
|
|
|
|
|
|
|
def set_derived_fields!
|
|
|
|
reset_invalidated_derived_values!(DEPENDENCIES)
|
|
|
|
|
|
|
|
self.pregblank = 1 if no_buyer_organisation?
|
|
|
|
self.ethnic = 17 if ethnic_refused?
|
|
|
|
self.mscharge = nil if no_monthly_leasehold_charges?
|
|
|
|
if exdate.present?
|
|
|
|
self.exday = exdate.day
|
|
|
|
self.exmonth = exdate.month
|
|
|
|
self.exyear = exdate.year
|
|
|
|
end
|
|
|
|
if hodate.present?
|
|
|
|
self.hoday = hodate.day
|
|
|
|
self.homonth = hodate.month
|
|
|
|
self.hoyear = hodate.year
|
|
|
|
end
|
|
|
|
|
|
|
|
if outright_sale?
|
|
|
|
if mortgage_not_used?
|
|
|
|
self.deposit = value
|
|
|
|
elsif mortgage_use_unknown?
|
|
|
|
self.deposit = nil
|
|
|
|
elsif mortgageused_changed?(from: 2, to: 1)
|
|
|
|
# Clear when switching mortgage used from no to yes
|
|
|
|
self.deposit = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if saledate && form.start_year_2024_or_later? && discounted_ownership_sale?
|
|
|
|
self.ppostcode_full = postcode_full
|
|
|
|
self.ppcodenk = pcodenk
|
|
|
|
self.prevloc = la
|
|
|
|
self.is_previous_la_inferred = is_la_inferred
|
|
|
|
self.previous_la_known = la_known
|
|
|
|
end
|
|
|
|
|
|
|
|
self.pcode1, self.pcode2 = postcode_full.split if postcode_full.present?
|
|
|
|
self.ppostc1, self.ppostc2 = ppostcode_full.split if ppostcode_full.present?
|
|
|
|
self.totchild = total_child
|
|
|
|
self.totadult = total_adult + total_elder
|
|
|
|
self.hhmemb = number_of_household_members
|
|
|
|
self.hhtype = household_type
|
|
|
|
|
|
|
|
if saledate && form.start_year_2024_or_later?
|
|
|
|
self.soctenant = soctenant_from_prevten_values
|
|
|
|
clear_child_ecstat_for_age_changes!
|
|
|
|
child_under_16_constraints!
|
|
|
|
end
|
|
|
|
|
|
|
|
self.uprn_known = 0 if address_answered_without_uprn?
|
|
|
|
|
|
|
|
if uprn_known&.zero?
|
|
|
|
self.uprn = nil
|
|
|
|
if uprn_known_was == 1
|
CLDC-3787 Autocomplete address search (#2924)
* Prototype
* Remove git from dockerfile
* UPRN search too
* Revert address client and use uprn client
* Add address search to lettings too
* Updates with lettings logs
* Update copy
* Move guidance to partial
* Fix uprn return
* Delete new db file, restore old
* Lint
* Remove old db file
* Lint
* Add new db file, remove old
* JS lint
* Update schema
* Add manual entry option
* Update derived variables
* Comment out old version of find address in 2024
* Remove db column
* Add new db columns
* Update guidance partial
* Add unless to migration
* Add migration files to remove and readd
* authenticate user
* Remove file
* Delete migration files
* Add search url
* Add search url
* Fix onConfirm
* Add manual entry button instead of change skip link
* Revert "Add manual entry button instead of change skip link"
This reverts commit 22577c801aca940acfc16caf94d3159071ea8258.
* Revert "Revert "Add manual entry button instead of change skip link""
This reverts commit 9f0a2111a58e933a28105e54aba6ca08c2d043b7.
* Replace uprn question
* Update question copy
* Allow changing the address search value
* Rename address autocomplete to address search
* Add buttons to switch between address questions
* Fix controller logic
* Enable adding question numbers to page headers
* Update skip links
* Add js disabled message to select
* Alternative way to handle js disabled users
* Revert "Alternative way to handle js disabled users"
This reverts commit 10da3d61e2f89ec29ef9f9071c63eb99aa2bb482.
* Fix typo
* Fix address options for address search question
* Reuse AddressDataPresenter where appropriate
* Lint
* Remove uprn selection question tests
* Reuse UprnDataPresenter where appropriate
* CSV export, exclude address_search
* Add address search to sales and lettings factory bots
* Exclude old address questions from routing, keep as exported values
* lint
* Update uprn value
* Add address search input boolean and switch between questions
* Reword copy, remove "Find" and "Search by"
* Align address questions, add question number and question text
* Remove old wip depends on
* Update some tests
* Update migration, move default value from db to model
* Update test
* Remove binding pry
* Lint
* Update test
* Lint
* Update test
* Update routes with underscores
* Remove debugging
* Limit visible logs to user
* Add manual address entry selected variable
* Change address search min length to 3chars
* Remove binding.pry
* Update factory bots, manual_address_entry_selected to true for preexisting tests
* Update model tests
* Update sales model tests excl E-code tests
* Update address search request test
* Reuse uprn id instead of address_search
* Set manual address entry selected as false when creating test logs
* Update model test
* Update request tests and remove old questions
* Add back test
* Update services
* Update more tests
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
* Update request tests
* update model tests
* Also update sales log
* Update service csv uprn_selection values to 1
* Add tests for pages and questions
* Update test
* Update uprn_known
* Lint
* Add feature test
* Update test
* Update tests
* Remove test
* pre-consolidate migration files
* Indentation
* Controller method improvements
* Update question numbers for 2025/26
* Update question numbers tests
* consolidate and delete old migration files
* undo changes to schema.rb
* Update 2025 property information translation files
* Update answer options to show singular previously selected result if present
* Move buttons to bottom guidance partials
* Small improvements, make address search and existing search more similar
* Validate entered addresses as within England
* Update test
* Revert "Validate entered addresses as within England"
This reverts commit 2dbfbcc8a5188cde7fb0ac0dcdbc5919eefd6a12.
* Add missing button to sales address page
* Change error code
* Clear invalid options
* Edit no results message method
* Keep no result logic just change text
* Display uprn value with address value
* Still show no results message when characters entered is less than 3 rather than nothing
* Fix uprn result when query is ambiguous
* Reduce min match for address search
* Hide no result found message just before results are populated
* Prevent changing logs to 2025 with invalid addresses
* Correct attribute name
* Handle nil
* Remove custom error message
* Remove unused variables from factory
* Update tests, remove address and postcode from old find address
* Fix bug clearing uprn from see all answers
* Revert "Fix bug clearing uprn from see all answers"
This reverts commit a66c47a1abf7a429f25e0a016fedb0b92e92f15c.
* Undo changes to validation method
* Fix unchanged uprn_selection when clearing or changing uprn
* Undo a change
* Update bulk upload 2025
* Fix typo
* Remove redundant line
---------
Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
2 weeks ago
|
|
|
reset_address_fields!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if uprn_known == 1 && uprn_confirmed&.zero?
|
CLDC-3787 Autocomplete address search (#2924)
* Prototype
* Remove git from dockerfile
* UPRN search too
* Revert address client and use uprn client
* Add address search to lettings too
* Updates with lettings logs
* Update copy
* Move guidance to partial
* Fix uprn return
* Delete new db file, restore old
* Lint
* Remove old db file
* Lint
* Add new db file, remove old
* JS lint
* Update schema
* Add manual entry option
* Update derived variables
* Comment out old version of find address in 2024
* Remove db column
* Add new db columns
* Update guidance partial
* Add unless to migration
* Add migration files to remove and readd
* authenticate user
* Remove file
* Delete migration files
* Add search url
* Add search url
* Fix onConfirm
* Add manual entry button instead of change skip link
* Revert "Add manual entry button instead of change skip link"
This reverts commit 22577c801aca940acfc16caf94d3159071ea8258.
* Revert "Revert "Add manual entry button instead of change skip link""
This reverts commit 9f0a2111a58e933a28105e54aba6ca08c2d043b7.
* Replace uprn question
* Update question copy
* Allow changing the address search value
* Rename address autocomplete to address search
* Add buttons to switch between address questions
* Fix controller logic
* Enable adding question numbers to page headers
* Update skip links
* Add js disabled message to select
* Alternative way to handle js disabled users
* Revert "Alternative way to handle js disabled users"
This reverts commit 10da3d61e2f89ec29ef9f9071c63eb99aa2bb482.
* Fix typo
* Fix address options for address search question
* Reuse AddressDataPresenter where appropriate
* Lint
* Remove uprn selection question tests
* Reuse UprnDataPresenter where appropriate
* CSV export, exclude address_search
* Add address search to sales and lettings factory bots
* Exclude old address questions from routing, keep as exported values
* lint
* Update uprn value
* Add address search input boolean and switch between questions
* Reword copy, remove "Find" and "Search by"
* Align address questions, add question number and question text
* Remove old wip depends on
* Update some tests
* Update migration, move default value from db to model
* Update test
* Remove binding pry
* Lint
* Update test
* Lint
* Update test
* Update routes with underscores
* Remove debugging
* Limit visible logs to user
* Add manual address entry selected variable
* Change address search min length to 3chars
* Remove binding.pry
* Update factory bots, manual_address_entry_selected to true for preexisting tests
* Update model tests
* Update sales model tests excl E-code tests
* Update address search request test
* Reuse uprn id instead of address_search
* Set manual address entry selected as false when creating test logs
* Update model test
* Update request tests and remove old questions
* Add back test
* Update services
* Update more tests
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
* Update request tests
* update model tests
* Also update sales log
* Update service csv uprn_selection values to 1
* Add tests for pages and questions
* Update test
* Update uprn_known
* Lint
* Add feature test
* Update test
* Update tests
* Remove test
* pre-consolidate migration files
* Indentation
* Controller method improvements
* Update question numbers for 2025/26
* Update question numbers tests
* consolidate and delete old migration files
* undo changes to schema.rb
* Update 2025 property information translation files
* Update answer options to show singular previously selected result if present
* Move buttons to bottom guidance partials
* Small improvements, make address search and existing search more similar
* Validate entered addresses as within England
* Update test
* Revert "Validate entered addresses as within England"
This reverts commit 2dbfbcc8a5188cde7fb0ac0dcdbc5919eefd6a12.
* Add missing button to sales address page
* Change error code
* Clear invalid options
* Edit no results message method
* Keep no result logic just change text
* Display uprn value with address value
* Still show no results message when characters entered is less than 3 rather than nothing
* Fix uprn result when query is ambiguous
* Reduce min match for address search
* Hide no result found message just before results are populated
* Prevent changing logs to 2025 with invalid addresses
* Correct attribute name
* Handle nil
* Remove custom error message
* Remove unused variables from factory
* Update tests, remove address and postcode from old find address
* Fix bug clearing uprn from see all answers
* Revert "Fix bug clearing uprn from see all answers"
This reverts commit a66c47a1abf7a429f25e0a016fedb0b92e92f15c.
* Undo changes to validation method
* Fix unchanged uprn_selection when clearing or changing uprn
* Undo a change
* Update bulk upload 2025
* Fix typo
* Remove redundant line
---------
Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
2 weeks ago
|
|
|
reset_address_fields!
|
|
|
|
self.uprn_known = 0
|
|
|
|
self.uprn_confirmed = nil
|
CLDC-3787 Autocomplete address search (#2924)
* Prototype
* Remove git from dockerfile
* UPRN search too
* Revert address client and use uprn client
* Add address search to lettings too
* Updates with lettings logs
* Update copy
* Move guidance to partial
* Fix uprn return
* Delete new db file, restore old
* Lint
* Remove old db file
* Lint
* Add new db file, remove old
* JS lint
* Update schema
* Add manual entry option
* Update derived variables
* Comment out old version of find address in 2024
* Remove db column
* Add new db columns
* Update guidance partial
* Add unless to migration
* Add migration files to remove and readd
* authenticate user
* Remove file
* Delete migration files
* Add search url
* Add search url
* Fix onConfirm
* Add manual entry button instead of change skip link
* Revert "Add manual entry button instead of change skip link"
This reverts commit 22577c801aca940acfc16caf94d3159071ea8258.
* Revert "Revert "Add manual entry button instead of change skip link""
This reverts commit 9f0a2111a58e933a28105e54aba6ca08c2d043b7.
* Replace uprn question
* Update question copy
* Allow changing the address search value
* Rename address autocomplete to address search
* Add buttons to switch between address questions
* Fix controller logic
* Enable adding question numbers to page headers
* Update skip links
* Add js disabled message to select
* Alternative way to handle js disabled users
* Revert "Alternative way to handle js disabled users"
This reverts commit 10da3d61e2f89ec29ef9f9071c63eb99aa2bb482.
* Fix typo
* Fix address options for address search question
* Reuse AddressDataPresenter where appropriate
* Lint
* Remove uprn selection question tests
* Reuse UprnDataPresenter where appropriate
* CSV export, exclude address_search
* Add address search to sales and lettings factory bots
* Exclude old address questions from routing, keep as exported values
* lint
* Update uprn value
* Add address search input boolean and switch between questions
* Reword copy, remove "Find" and "Search by"
* Align address questions, add question number and question text
* Remove old wip depends on
* Update some tests
* Update migration, move default value from db to model
* Update test
* Remove binding pry
* Lint
* Update test
* Lint
* Update test
* Update routes with underscores
* Remove debugging
* Limit visible logs to user
* Add manual address entry selected variable
* Change address search min length to 3chars
* Remove binding.pry
* Update factory bots, manual_address_entry_selected to true for preexisting tests
* Update model tests
* Update sales model tests excl E-code tests
* Update address search request test
* Reuse uprn id instead of address_search
* Set manual address entry selected as false when creating test logs
* Update model test
* Update request tests and remove old questions
* Add back test
* Update services
* Update more tests
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
* Update request tests
* update model tests
* Also update sales log
* Update service csv uprn_selection values to 1
* Add tests for pages and questions
* Update test
* Update uprn_known
* Lint
* Add feature test
* Update test
* Update tests
* Remove test
* pre-consolidate migration files
* Indentation
* Controller method improvements
* Update question numbers for 2025/26
* Update question numbers tests
* consolidate and delete old migration files
* undo changes to schema.rb
* Update 2025 property information translation files
* Update answer options to show singular previously selected result if present
* Move buttons to bottom guidance partials
* Small improvements, make address search and existing search more similar
* Validate entered addresses as within England
* Update test
* Revert "Validate entered addresses as within England"
This reverts commit 2dbfbcc8a5188cde7fb0ac0dcdbc5919eefd6a12.
* Add missing button to sales address page
* Change error code
* Clear invalid options
* Edit no results message method
* Keep no result logic just change text
* Display uprn value with address value
* Still show no results message when characters entered is less than 3 rather than nothing
* Fix uprn result when query is ambiguous
* Reduce min match for address search
* Hide no result found message just before results are populated
* Prevent changing logs to 2025 with invalid addresses
* Correct attribute name
* Handle nil
* Remove custom error message
* Remove unused variables from factory
* Update tests, remove address and postcode from old find address
* Fix bug clearing uprn from see all answers
* Revert "Fix bug clearing uprn from see all answers"
This reverts commit a66c47a1abf7a429f25e0a016fedb0b92e92f15c.
* Undo changes to validation method
* Fix unchanged uprn_selection when clearing or changing uprn
* Undo a change
* Update bulk upload 2025
* Fix typo
* Remove redundant line
---------
Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
2 weeks ago
|
|
|
end
|
|
|
|
|
|
|
|
if form.start_year_2024_or_later?
|
|
|
|
if manual_address_entry_selected
|
|
|
|
self.uprn_known = 0
|
|
|
|
self.uprn_selection = nil
|
|
|
|
self.uprn_confirmed = nil
|
|
|
|
else
|
|
|
|
self.uprn_confirmed = 1 if uprn.present?
|
|
|
|
self.uprn_known = 1 if uprn.present?
|
|
|
|
reset_address_fields! if uprn.blank?
|
|
|
|
if uprn_changed?
|
|
|
|
self.uprn_selection = uprn
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if form.start_year_2025_or_later? && is_bedsit?
|
|
|
|
self.beds = 1
|
|
|
|
end
|
|
|
|
|
|
|
|
self.nationality_all = nationality_all_group if nationality_uk_or_prefers_not_to_say?
|
|
|
|
self.nationality_all_buyer2 = nationality_all_buyer2_group if nationality2_uk_or_prefers_not_to_say?
|
|
|
|
|
|
|
|
if saledate_changed? && !LocalAuthority.active(saledate).where(code: la).exists?
|
|
|
|
self.la = nil
|
|
|
|
self.is_la_inferred = false
|
|
|
|
end
|
|
|
|
|
|
|
|
self.numstair = is_firststair? ? 1 : nil if numstair == 1 && firststair_changed?
|
|
|
|
self.mrent = 0 if stairowned_100?
|
|
|
|
|
|
|
|
set_encoded_derived_values!(DEPENDENCIES)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
DEPENDENCIES = [
|
|
|
|
{
|
|
|
|
conditions: {
|
|
|
|
buylivein: 2,
|
|
|
|
},
|
|
|
|
derived_values: {
|
|
|
|
buy1livein: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
conditions: {
|
|
|
|
buylivein: 2,
|
|
|
|
jointpur: 1,
|
|
|
|
},
|
|
|
|
derived_values: {
|
|
|
|
buy1livein: 2,
|
|
|
|
buy2livein: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
conditions: {
|
|
|
|
buylivein: 1,
|
|
|
|
jointpur: 2,
|
|
|
|
},
|
|
|
|
derived_values: {
|
|
|
|
buy1livein: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
conditions: {
|
|
|
|
mortgageused: 2,
|
|
|
|
},
|
|
|
|
derived_values: {
|
|
|
|
mortgage: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
conditions: {
|
|
|
|
mortgageused: 3,
|
|
|
|
},
|
|
|
|
derived_values: {
|
|
|
|
mortgage: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
].freeze
|
|
|
|
|
|
|
|
def number_of_household_members
|
|
|
|
return unless hholdcount.present? && jointpur.present?
|
|
|
|
|
|
|
|
number_of_buyers = joint_purchase? ? 2 : 1
|
|
|
|
hholdcount + number_of_buyers
|
|
|
|
end
|
|
|
|
|
|
|
|
def total_elder
|
|
|
|
ages = [age1, age2, age3, age4, age5, age6]
|
|
|
|
ages.count { |age| age.present? && age >= 60 }
|
|
|
|
end
|
|
|
|
|
|
|
|
def total_child
|
|
|
|
(2..6).count do |i|
|
|
|
|
age = public_send("age#{i}")
|
|
|
|
relat = public_send("relat#{i}")
|
|
|
|
age.present? && (age < 20 && %w[C].include?(relat) || age < 18)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def total_adult
|
|
|
|
total = age1.present? && age1.between?(16, 59) ? 1 : 0
|
|
|
|
total + (2..6).count do |i|
|
|
|
|
age = public_send("age#{i}")
|
|
|
|
relat = public_send("relat#{i}")
|
|
|
|
age.present? && (age.between?(20, 59) || age.between?(18, 19) && relat != "C")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def child_under_16_constraints!
|
|
|
|
start_index = joint_purchase? ? 3 : 2
|
|
|
|
(start_index..6).each do |idx|
|
|
|
|
if age_under_16?(idx)
|
|
|
|
self["ecstat#{idx}"] = 9
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def clear_child_ecstat_for_age_changes!
|
|
|
|
start_index = joint_purchase? ? 3 : 2
|
|
|
|
(start_index..6).each do |idx|
|
|
|
|
if public_send("age#{idx}_changed?") && self["ecstat#{idx}"] == 9
|
|
|
|
self["ecstat#{idx}"] = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def household_type
|
|
|
|
return unless total_elder && total_adult && totchild
|
|
|
|
|
|
|
|
if only_one_elder?
|
|
|
|
1
|
|
|
|
elsif only_two_elders?
|
|
|
|
2
|
|
|
|
elsif only_one_adult?
|
|
|
|
3
|
|
|
|
elsif only_two_adults?
|
|
|
|
4
|
|
|
|
elsif one_adult_with_at_least_one_child?
|
|
|
|
5
|
|
|
|
elsif at_least_two_adults_with_at_least_one_child?
|
|
|
|
6
|
|
|
|
else
|
|
|
|
9
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def at_least_two_adults_with_at_least_one_child?
|
|
|
|
total_elder.zero? && total_adult >= 2 && totchild >= 1
|
|
|
|
end
|
|
|
|
|
|
|
|
def one_adult_with_at_least_one_child?
|
|
|
|
total_elder.zero? && total_adult == 1 && totchild >= 1
|
|
|
|
end
|
|
|
|
|
|
|
|
def only_two_adults?
|
|
|
|
total_elder.zero? && total_adult == 2 && totchild.zero?
|
|
|
|
end
|
|
|
|
|
|
|
|
def only_one_adult?
|
|
|
|
total_elder.zero? && total_adult == 1 && totchild.zero?
|
|
|
|
end
|
|
|
|
|
|
|
|
def only_two_elders?
|
|
|
|
total_elder == 2 && total_adult.zero? && totchild.zero?
|
|
|
|
end
|
|
|
|
|
|
|
|
def only_one_elder?
|
|
|
|
total_elder == 1 && total_adult.zero? && totchild.zero?
|
|
|
|
end
|
|
|
|
|
|
|
|
def address_answered_without_uprn?
|
|
|
|
[address_line1, town_or_city].all?(&:present?) && uprn.nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
def soctenant_from_prevten_values
|
|
|
|
return unless prevten && shared_ownership_scheme?
|
|
|
|
|
|
|
|
prevten_was_social_housing? ? 1 : 2
|
|
|
|
end
|
|
|
|
|
|
|
|
def prevten_was_social_housing?
|
|
|
|
[1, 2].include?(prevten) || [1, 2].include?(prevtenbuy2)
|
|
|
|
end
|
CLDC-3787 Autocomplete address search (#2924)
* Prototype
* Remove git from dockerfile
* UPRN search too
* Revert address client and use uprn client
* Add address search to lettings too
* Updates with lettings logs
* Update copy
* Move guidance to partial
* Fix uprn return
* Delete new db file, restore old
* Lint
* Remove old db file
* Lint
* Add new db file, remove old
* JS lint
* Update schema
* Add manual entry option
* Update derived variables
* Comment out old version of find address in 2024
* Remove db column
* Add new db columns
* Update guidance partial
* Add unless to migration
* Add migration files to remove and readd
* authenticate user
* Remove file
* Delete migration files
* Add search url
* Add search url
* Fix onConfirm
* Add manual entry button instead of change skip link
* Revert "Add manual entry button instead of change skip link"
This reverts commit 22577c801aca940acfc16caf94d3159071ea8258.
* Revert "Revert "Add manual entry button instead of change skip link""
This reverts commit 9f0a2111a58e933a28105e54aba6ca08c2d043b7.
* Replace uprn question
* Update question copy
* Allow changing the address search value
* Rename address autocomplete to address search
* Add buttons to switch between address questions
* Fix controller logic
* Enable adding question numbers to page headers
* Update skip links
* Add js disabled message to select
* Alternative way to handle js disabled users
* Revert "Alternative way to handle js disabled users"
This reverts commit 10da3d61e2f89ec29ef9f9071c63eb99aa2bb482.
* Fix typo
* Fix address options for address search question
* Reuse AddressDataPresenter where appropriate
* Lint
* Remove uprn selection question tests
* Reuse UprnDataPresenter where appropriate
* CSV export, exclude address_search
* Add address search to sales and lettings factory bots
* Exclude old address questions from routing, keep as exported values
* lint
* Update uprn value
* Add address search input boolean and switch between questions
* Reword copy, remove "Find" and "Search by"
* Align address questions, add question number and question text
* Remove old wip depends on
* Update some tests
* Update migration, move default value from db to model
* Update test
* Remove binding pry
* Lint
* Update test
* Lint
* Update test
* Update routes with underscores
* Remove debugging
* Limit visible logs to user
* Add manual address entry selected variable
* Change address search min length to 3chars
* Remove binding.pry
* Update factory bots, manual_address_entry_selected to true for preexisting tests
* Update model tests
* Update sales model tests excl E-code tests
* Update address search request test
* Reuse uprn id instead of address_search
* Set manual address entry selected as false when creating test logs
* Update model test
* Update request tests and remove old questions
* Add back test
* Update services
* Update more tests
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
* Update request tests
* update model tests
* Also update sales log
* Update service csv uprn_selection values to 1
* Add tests for pages and questions
* Update test
* Update uprn_known
* Lint
* Add feature test
* Update test
* Update tests
* Remove test
* pre-consolidate migration files
* Indentation
* Controller method improvements
* Update question numbers for 2025/26
* Update question numbers tests
* consolidate and delete old migration files
* undo changes to schema.rb
* Update 2025 property information translation files
* Update answer options to show singular previously selected result if present
* Move buttons to bottom guidance partials
* Small improvements, make address search and existing search more similar
* Validate entered addresses as within England
* Update test
* Revert "Validate entered addresses as within England"
This reverts commit 2dbfbcc8a5188cde7fb0ac0dcdbc5919eefd6a12.
* Add missing button to sales address page
* Change error code
* Clear invalid options
* Edit no results message method
* Keep no result logic just change text
* Display uprn value with address value
* Still show no results message when characters entered is less than 3 rather than nothing
* Fix uprn result when query is ambiguous
* Reduce min match for address search
* Hide no result found message just before results are populated
* Prevent changing logs to 2025 with invalid addresses
* Correct attribute name
* Handle nil
* Remove custom error message
* Remove unused variables from factory
* Update tests, remove address and postcode from old find address
* Fix bug clearing uprn from see all answers
* Revert "Fix bug clearing uprn from see all answers"
This reverts commit a66c47a1abf7a429f25e0a016fedb0b92e92f15c.
* Undo changes to validation method
* Fix unchanged uprn_selection when clearing or changing uprn
* Undo a change
* Update bulk upload 2025
* Fix typo
* Remove redundant line
---------
Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
Co-authored-by: kosiakkatrina <kosiakkatrina@users.noreply.github.com>
2 weeks ago
|
|
|
|
|
|
|
def reset_address_fields!
|
|
|
|
self.uprn = nil
|
|
|
|
self.uprn_known = nil
|
|
|
|
self.address_line1 = nil
|
|
|
|
self.address_line2 = nil
|
|
|
|
self.town_or_city = nil
|
|
|
|
self.county = nil
|
|
|
|
self.pcode1 = nil
|
|
|
|
self.pcode2 = nil
|
|
|
|
self.pcodenk = nil
|
|
|
|
self.address_line1_input = nil
|
|
|
|
self.postcode_full_input = nil
|
|
|
|
self.postcode_full = nil
|
|
|
|
self.is_la_inferred = nil
|
|
|
|
self.la = nil
|
|
|
|
end
|
|
|
|
end
|