From fe4e01e0fd5143c5af0ef015bdd636e631f9be63 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Thu, 16 Nov 2023 16:54:16 +0000 Subject: [PATCH] feat: infer uprn_known as No if the user answers address (through "Enter address instead" route/check answers page) --- app/models/derived_variables/lettings_log_variables.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 7d1274540..544230464 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -95,6 +95,8 @@ module DerivedVariables::LettingsLogVariables set_housingneeds_fields if housingneeds? + self.uprn_known = 0 if address_answered? + if uprn_known&.zero? self.uprn = nil end @@ -310,6 +312,10 @@ private self.county = nil end + def address_answered? + [address_line1, town_or_city].all?(&:present?) + end + def get_lar return 1 if rent_type == 2 return 2 if rent_type == 1