From 61baaebdd7e7b9bcb699202d4a754de5e7696410 Mon Sep 17 00:00:00 2001 From: Carolyn Date: Tue, 27 Jan 2026 13:28:07 +0000 Subject: [PATCH 01/17] CLDC-4146 infer no to multiple partners --- .../lettings_log_variables.rb | 21 +++ .../lettings/pages/person_lead_partner.rb | 5 +- .../form/lettings/questions/person_partner.rb | 6 + .../subsections/household_characteristics.rb | 42 ++--- app/models/lettings_log.rb | 4 + spec/factories/lettings_log.rb | 2 +- .../pages/person_lead_partner_spec.rb | 7 +- .../lettings/questions/person_partner_spec.rb | 4 + .../household_characteristics_spec.rb | 7 - .../lettings_log_derived_fields_spec.rb | 152 ++++++++++++++++++ 10 files changed, 219 insertions(+), 31 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 1c7f161c1..68fa67438 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -75,6 +75,10 @@ module DerivedVariables::LettingsLogVariables self.beds = nil end + if form.start_year_2026_or_later? + infer_at_most_one_relationship! + end + clear_child_constraints_for_age_changes! child_under_16_constraints! @@ -295,6 +299,23 @@ private end end + def infer_at_most_one_relationship! + new_partner_numbers = partner_numbers.select { |i| public_send("relat#{i}_changed?") } + if new_partner_numbers.any? + infer_only_partner!(new_partner_numbers.first) + elsif partner_numbers.any? + infer_only_partner!(partner_numbers.first) + end + end + + def infer_only_partner!(partner_number) + other_partner_numbers = partner_numbers.reject { |x| x == partner_number } + other_partner_numbers.each { |i| self["relat#{i}"] = "X" } + + unanswered_partner_questions = (2..8).select { |i| public_send("relat#{i}").nil? } + unanswered_partner_questions.each { |i| self["relat#{i}"] = "X" } + end + def household_type return unless totelder && totadult && totchild diff --git a/app/models/form/lettings/pages/person_lead_partner.rb b/app/models/form/lettings/pages/person_lead_partner.rb index 36f2e9b11..17d63149c 100644 --- a/app/models/form/lettings/pages/person_lead_partner.rb +++ b/app/models/form/lettings/pages/person_lead_partner.rb @@ -18,8 +18,11 @@ class Form::Lettings::Pages::PersonLeadPartner < ::Form::Page "operator" => ">=", "operand" => 16, }, + **(2...@person_index).map { |i| ["relat#{i}", { "operator" => "!=", "operand" => "P" }] }.to_h, }, - { "details_known_#{@person_index}" => 0, "age#{@person_index}" => nil }, + { "details_known_#{@person_index}" => 0, + "age#{@person_index}" => nil, + **(2...@person_index).map { |i| ["relat#{i}", { "operator" => "!=", "operand" => "P" }] }.to_h }, ] else [{ "details_known_#{@person_index}" => 0 }] diff --git a/app/models/form/lettings/questions/person_partner.rb b/app/models/form/lettings/questions/person_partner.rb index 98a22a448..7a09ca8cd 100644 --- a/app/models/form/lettings/questions/person_partner.rb +++ b/app/models/form/lettings/questions/person_partner.rb @@ -7,6 +7,12 @@ class Form::Lettings::Questions::PersonPartner < ::Form::Question @answer_options = answer_options @person_index = person_index @question_number = question_number + @hidden_in_check_answers = { + "depends_on" => (2...person_index).map do |i| + { "relat#{i}" => "P", "relat#{person_index}" => "X" } + end, + } + @disable_clearing_if_not_routed_or_dynamic_answer_options = form.start_year_2026_or_later? end def answer_options diff --git a/app/models/form/lettings/subsections/household_characteristics.rb b/app/models/form/lettings/subsections/household_characteristics.rb index 074709f8d..b87897e3b 100644 --- a/app/models/form/lettings/subsections/household_characteristics.rb +++ b/app/models/form/lettings/subsections/household_characteristics.rb @@ -35,8 +35,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 2), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 2) if form.start_year_2026_or_later?), relationship_question(person_index: 2), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_2_multiple_partners_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_2_partner_under_16_value_check", nil, self, person_index: 2) unless form.start_year_2026_or_later?), + (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_2_multiple_partners_value_check", nil, self, person_index: 2) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 2) unless form.start_year_2026_or_later?), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 2), @@ -44,7 +44,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 2), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_2_under_retirement_value_check", nil, self, person_index: 2), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_2_over_retirement_value_check", nil, self, person_index: 2), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_2_partner_under_16_value_check", nil, self, person_index: 2) unless form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 2), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 2), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, @@ -57,8 +57,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 3), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 3) if form.start_year_2026_or_later?), relationship_question(person_index: 3), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_3_multiple_partners_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_3_partner_under_16_value_check", nil, self, person_index: 3) unless form.start_year_2026_or_later?), + (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_3_multiple_partners_value_check", nil, self, person_index: 3) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 3) unless form.start_year_2026_or_later?), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 3), @@ -66,7 +66,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 3), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_3_under_retirement_value_check", nil, self, person_index: 3), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_3_over_retirement_value_check", nil, self, person_index: 3), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_3_partner_under_16_value_check", nil, self, person_index: 3) unless form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 3), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 3), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, @@ -79,8 +79,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 4), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 4) if form.start_year_2026_or_later?), relationship_question(person_index: 4), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_4_multiple_partners_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_4_partner_under_16_value_check", nil, self, person_index: 4) unless form.start_year_2026_or_later?), + (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_4_multiple_partners_value_check", nil, self, person_index: 4) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 4) unless form.start_year_2026_or_later?), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 4), @@ -88,7 +88,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 4), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_4_under_retirement_value_check", nil, self, person_index: 4), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_4_over_retirement_value_check", nil, self, person_index: 4), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_4_partner_under_16_value_check", nil, self, person_index: 4) unless form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 4), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 4), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, @@ -101,8 +101,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 5), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 5) if form.start_year_2026_or_later?), relationship_question(person_index: 5), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_5_multiple_partners_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_5_partner_under_16_value_check", nil, self, person_index: 5) unless form.start_year_2026_or_later?), + (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_5_multiple_partners_value_check", nil, self, person_index: 5) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 5) unless form.start_year_2026_or_later?), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 5), @@ -110,7 +110,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 5), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_5_under_retirement_value_check", nil, self, person_index: 5), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_5_over_retirement_value_check", nil, self, person_index: 5), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_5_partner_under_16_value_check", nil, self, person_index: 5) unless form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 5), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 5), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, @@ -123,8 +123,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 6), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 6) if form.start_year_2026_or_later?), relationship_question(person_index: 6), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_6_multiple_partners_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_6_partner_under_16_value_check", nil, self, person_index: 6) unless form.start_year_2026_or_later?), + (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_6_multiple_partners_value_check", nil, self, person_index: 6) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 6) unless form.start_year_2026_or_later?), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 6), @@ -132,7 +132,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 6), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_6_under_retirement_value_check", nil, self, person_index: 6), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_6_over_retirement_value_check", nil, self, person_index: 6), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_6_partner_under_16_value_check", nil, self, person_index: 6) unless form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 6), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 6), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, @@ -145,8 +145,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 7), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 7) if form.start_year_2026_or_later?), relationship_question(person_index: 7), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_7_partner_under_16_value_check", nil, self, person_index: 7) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_7_multiple_partners_value_check", nil, self, person_index: 7) if form.start_year_2024_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_7_partner_under_16_value_check", nil, self, person_index: 7) unless form.start_year_2026_or_later?), + (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_7_multiple_partners_value_check", nil, self, person_index: 7) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 7) unless form.start_year_2026_or_later?), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 7), @@ -154,7 +154,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 7), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_7_under_retirement_value_check", nil, self, person_index: 7), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_7_over_retirement_value_check", nil, self, person_index: 7), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_7_partner_under_16_value_check", nil, self, person_index: 7) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_7_partner_under_16_value_check", nil, self, person_index: 7) unless form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 7), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 7), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, @@ -167,8 +167,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 8), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 8) if form.start_year_2026_or_later?), relationship_question(person_index: 8), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_8_partner_under_16_value_check", nil, self, person_index: 8) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_8_multiple_partners_value_check", nil, self, person_index: 8) if form.start_year_2024_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_8_partner_under_16_value_check", nil, self, person_index: 8) unless form.start_year_2026_or_later?), + (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_8_multiple_partners_value_check", nil, self, person_index: 8) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index: 8) unless form.start_year_2026_or_later?), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 8), @@ -176,7 +176,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 8), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_8_under_retirement_value_check", nil, self, person_index: 8), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_8_over_retirement_value_check", nil, self, person_index: 8), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_8_partner_under_16_value_check", nil, self, person_index: 8) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_8_partner_under_16_value_check", nil, self, person_index: 8) unless form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 8), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 8), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index f2230c4e5..cdd52799b 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -876,6 +876,10 @@ private end end + def partner_numbers + (2..8).select { |i| public_send("relat#{i}") == "P" } + end + def age_refused? [age1_known, age2_known, age3_known, age4_known, age5_known, age6_known, age7_known, age8_known].any?(1) end diff --git a/spec/factories/lettings_log.rb b/spec/factories/lettings_log.rb index 62cc94a14..d65133894 100644 --- a/spec/factories/lettings_log.rb +++ b/spec/factories/lettings_log.rb @@ -131,7 +131,7 @@ FactoryBot.define do rp_hardship { 0 } rp_dontknow { 0 } tenancyother { nil } - net_income_value_check { nil } + net_income_value_check { 1 } void_date_value_check { 1 } major_repairs_date_value_check { 1 } net_income_known { 0 } diff --git a/spec/models/form/lettings/pages/person_lead_partner_spec.rb b/spec/models/form/lettings/pages/person_lead_partner_spec.rb index 55ee97e1d..adff653da 100644 --- a/spec/models/form/lettings/pages/person_lead_partner_spec.rb +++ b/spec/models/form/lettings/pages/person_lead_partner_spec.rb @@ -96,8 +96,13 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do "operator" => ">=", "operand" => 16, }, + "relat2" => { "operator" => "!=", "operand" => "P" }, + }, + { + "details_known_3" => 0, + "age3" => nil, + "relat2" => { "operator" => "!=", "operand" => "P" }, }, - { "details_known_3" => 0, "age3" => nil }, ], ) end diff --git a/spec/models/form/lettings/questions/person_partner_spec.rb b/spec/models/form/lettings/questions/person_partner_spec.rb index 2106bc36f..1770526dc 100644 --- a/spec/models/form/lettings/questions/person_partner_spec.rb +++ b/spec/models/form/lettings/questions/person_partner_spec.rb @@ -105,5 +105,9 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct check_answers_card_number" do expect(question.check_answers_card_number).to eq(3) end + + it "has the correct hidden_in_check_answers" do + expect(question.hidden_in_check_answers).to eq("relat2" => "P", "relat3" => "X") + end end end diff --git a/spec/models/form/lettings/subsections/household_characteristics_spec.rb b/spec/models/form/lettings/subsections/household_characteristics_spec.rb index 3269514d2..35c62ad84 100644 --- a/spec/models/form/lettings/subsections/household_characteristics_spec.rb +++ b/spec/models/form/lettings/subsections/household_characteristics_spec.rb @@ -364,7 +364,6 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod person_2_known person_2_age person_2_lead_partner - relationship_2_multiple_partners_value_check no_females_pregnant_household_person_2_age_value_check females_in_soft_age_range_in_pregnant_household_person_2_age_value_check age_2_under_retirement_value_check @@ -380,7 +379,6 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod person_3_known person_3_age person_3_lead_partner - relationship_3_multiple_partners_value_check no_females_pregnant_household_person_3_age_value_check females_in_soft_age_range_in_pregnant_household_person_3_age_value_check age_3_under_retirement_value_check @@ -396,7 +394,6 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod person_4_known person_4_age person_4_lead_partner - relationship_4_multiple_partners_value_check no_females_pregnant_household_person_4_age_value_check females_in_soft_age_range_in_pregnant_household_person_4_age_value_check age_4_under_retirement_value_check @@ -412,7 +409,6 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod person_5_known person_5_age person_5_lead_partner - relationship_5_multiple_partners_value_check no_females_pregnant_household_person_5_age_value_check females_in_soft_age_range_in_pregnant_household_person_5_age_value_check age_5_under_retirement_value_check @@ -428,7 +424,6 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod person_6_known person_6_age person_6_lead_partner - relationship_6_multiple_partners_value_check no_females_pregnant_household_person_6_age_value_check females_in_soft_age_range_in_pregnant_household_person_6_age_value_check age_6_under_retirement_value_check @@ -444,7 +439,6 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod person_7_known person_7_age person_7_lead_partner - relationship_7_multiple_partners_value_check no_females_pregnant_household_person_7_age_value_check females_in_soft_age_range_in_pregnant_household_person_7_age_value_check age_7_under_retirement_value_check @@ -460,7 +454,6 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod person_8_known person_8_age person_8_lead_partner - relationship_8_multiple_partners_value_check no_females_pregnant_household_person_8_age_value_check females_in_soft_age_range_in_pregnant_household_person_8_age_value_check age_8_under_retirement_value_check diff --git a/spec/models/lettings_log_derived_fields_spec.rb b/spec/models/lettings_log_derived_fields_spec.rb index 9cb6cf7d1..9c9762e8e 100644 --- a/spec/models/lettings_log_derived_fields_spec.rb +++ b/spec/models/lettings_log_derived_fields_spec.rb @@ -1588,4 +1588,156 @@ RSpec.describe LettingsLog, type: :model do end end end + + describe "#infer_at_most_one_relationship!" do + context "when 2025", metadata: { year: 25 } do + before do + Timecop.freeze(Time.zone.local(2025, 5, 10)) + Singleton.__init__(FormHandler) + end + + after do + Timecop.return + Singleton.__init__(FormHandler) + end + + context "when there are no existing relationships" do + let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "X", relat4: "R") } + + it "does not infer no to any relationship answers when a new relationship is added" do + log.relat2 = "P" + expect { log.set_derived_fields! }.to not_change(log, :relat3) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + expect { log.set_derived_fields! }.to not_change(log, :relat5) + end + end + + context "when there is an existing relationship" do + let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "P", relat4: "R", relat5: "X") } + + it "does not infer no to any relationship answers when a new relationship is added" do + log.relat2 = "P" + expect { log.set_derived_fields! }.to not_change(log, :relat3) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + expect { log.set_derived_fields! }.to not_change(log, :relat5) + expect { log.set_derived_fields! }.to not_change(log, :relat6) + end + end + + context "when more than one relationship is set" do + let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "X", relat4: "R", relat5: "X") } + + before do + log.relat3 = "P" + log.relat2 = "P" + end + + it "does not infer no to any relationship answers" do + expect { log.set_derived_fields! }.to not_change(log, :relat2) + expect { log.set_derived_fields! }.to not_change(log, :relat3) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + expect { log.set_derived_fields! }.to not_change(log, :relat5) + expect { log.set_derived_fields! }.to not_change(log, :relat6) + end + end + end + + context "when 2026", metadata: { year: 26 } do + before do + Timecop.freeze(Time.zone.local(2026, 5, 10)) + Singleton.__init__(FormHandler) + end + + after do + Timecop.return + Singleton.__init__(FormHandler) + end + + context "when there are no existing relationships" do + let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "X", relat4: "R") } + + context "and a new relationship is added" do + before do + log.relat2 = "P" + end + + it "infers no to unanswered questions" do + expect { log.set_derived_fields! }.to change(log, :relat5).to "X" + end + + it "does not change relationship answers of no or prefer not to say" do + expect { log.set_derived_fields! }.to not_change(log, :relat3) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + end + end + + it "does not change other relationship values if no is changed to prefer not to say" do + log.relat2 = "R" + expect { log.set_derived_fields! }.to not_change(log, :relat3) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + end + + it "does not change other relationship values if prefer not to say is changed to no" do + log.relat4 = "X" + expect { log.set_derived_fields! }.to not_change(log, :relat2) + expect { log.set_derived_fields! }.to not_change(log, :relat3) + end + end + + context "when there is an existing relationship" do + let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "P", relat4: "R", relat5: "X") } + + context "and a new relationship is added" do + before do + log.relat6 = nil + log.relat2 = "P" + end + + it "infers no to the previous relationship" do + expect { log.set_derived_fields! }.to change(log, :relat3).to "X" + end + + it "infers no to unanswered questions" do + expect { log.set_derived_fields! }.to change(log, :relat6).to "X" + end + + it "does not change relationship answers of no or prefer not to say" do + expect { log.set_derived_fields! }.to not_change(log, :relat5) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + end + end + + it "does not change other relationship values if the partner is removed" do + log.relat3 = "X" + expect { log.set_derived_fields! }.to not_change(log, :relat2) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + expect { log.set_derived_fields! }.to not_change(log, :relat5) + expect { log.set_derived_fields! }.to not_change(log, :relat6) + end + end + + context "when more than one relationship is set" do + let(:log) { create(:lettings_log, :completed, hhmemb: 6, relat2: "X", relat3: "X", relat4: "R", relat5: "X") } + + before do + log.relat3 = "P" + log.relat2 = "P" + end + + it "keeps the lower numbered relationship and infers the higher numbered one to false" do + expect { log.set_derived_fields! }.to change(log, :relat3).to "X" + expect { log.set_derived_fields! }.to not_change(log, :relat2) + end + + it "infers no to unanswered questions" do + expect { log.set_derived_fields! }.to change(log, :relat6).to "X" + end + + it "does not change relationship answers of no or prefer not to say" do + expect { log.set_derived_fields! }.to not_change(log, :relat5) + expect { log.set_derived_fields! }.to not_change(log, :relat4) + end + end + end + end end From 7e02235672d315d1f576428695caed5a6dde35cf Mon Sep 17 00:00:00 2001 From: Carolyn Date: Wed, 28 Jan 2026 09:47:36 +0000 Subject: [PATCH 02/17] CLDC-4146 try removing factory change --- spec/factories/lettings_log.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/factories/lettings_log.rb b/spec/factories/lettings_log.rb index d65133894..62cc94a14 100644 --- a/spec/factories/lettings_log.rb +++ b/spec/factories/lettings_log.rb @@ -131,7 +131,7 @@ FactoryBot.define do rp_hardship { 0 } rp_dontknow { 0 } tenancyother { nil } - net_income_value_check { 1 } + net_income_value_check { nil } void_date_value_check { 1 } major_repairs_date_value_check { 1 } net_income_known { 0 } From 636bda30a8682afc6503947b90d4f9c6186333c1 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Thu, 5 Feb 2026 15:10:46 +0000 Subject: [PATCH 03/17] Simplify inference logic --- app/models/derived_variables/lettings_log_variables.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 68fa67438..22541c2e0 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -300,10 +300,7 @@ private end def infer_at_most_one_relationship! - new_partner_numbers = partner_numbers.select { |i| public_send("relat#{i}_changed?") } - if new_partner_numbers.any? - infer_only_partner!(new_partner_numbers.first) - elsif partner_numbers.any? + if partner_numbers.any? infer_only_partner!(partner_numbers.first) end end From e5197107264e19fecead9615308f2a856037cc49 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Thu, 5 Feb 2026 15:20:07 +0000 Subject: [PATCH 04/17] Fix not equals logic --- app/models/form.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/form.rb b/app/models/form.rb index e86596288..8370b7dbb 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -323,7 +323,12 @@ class Form if value.is_a?(Hash) && value.key?("operator") operator = value["operator"] operand = value["operand"] - log[question]&.send(operator, operand) + + if operator == "!=" # This branch is needed as `nil` does not behave as expected with the default logic (`nil&.send("!=", operand)` => `nil` i.e., `false`). + log[question] != operand + else + log[question]&.send(operator, operand) + end else parts = question.split(".") log_value = send_chain(parts, log) From 1c341bc3888d0ca69563b0a5f51ffd93dc89455a Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Mon, 9 Feb 2026 11:37:09 +0000 Subject: [PATCH 05/17] Improve person_partner tests --- .../lettings/questions/person_partner_spec.rb | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/spec/models/form/lettings/questions/person_partner_spec.rb b/spec/models/form/lettings/questions/person_partner_spec.rb index 1770526dc..9888c3bb0 100644 --- a/spec/models/form/lettings/questions/person_partner_spec.rb +++ b/spec/models/form/lettings/questions/person_partner_spec.rb @@ -45,6 +45,22 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do expect(question.hidden_in_check_answers).to be nil end + context "and in 2025", metadata: { year: 25 } do + let(:year) { 2025 } + + it "has the correct disable_clearing_if_not_routed_or_dynamic_answer_options value" do + expect(question.disable_clearing_if_not_routed_or_dynamic_answer_options).to eq(false) + end + end + + context "and in 2026", metadata: { year: 26 } do + let(:year) { 2026 } + + it "has the correct disable_clearing_if_not_routed_or_dynamic_answer_options value" do + expect(question.disable_clearing_if_not_routed_or_dynamic_answer_options).to eq(true) + end + end + context "with person 2" do it "has the correct id" do expect(question.id).to eq("relat2") @@ -110,4 +126,20 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do expect(question.hidden_in_check_answers).to eq("relat2" => "P", "relat3" => "X") end end + + context "with person 4" do + let(:person_index) { 4 } + + it "has the correct id" do + expect(question.id).to eq("relat4") + end + + it "has the correct check_answers_card_number" do + expect(question.check_answers_card_number).to eq(4) + end + + it "has the correct hidden_in_check_answers" do + expect(question.hidden_in_check_answers).to eq("depends_on" => [{"relat2"=>"P", "relat4"=>"X"}, {"relat3"=>"P", "relat4"=>"X"}]) + end + end end From b381edffcf311291135f6f5cf05daf6e6c9fb473 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Mon, 9 Feb 2026 11:56:11 +0000 Subject: [PATCH 06/17] Add tests for new not equals logic --- spec/features/form/page_routing_spec.rb | 72 +++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/spec/features/form/page_routing_spec.rb b/spec/features/form/page_routing_spec.rb index 470a2f8ed..6e903ded3 100644 --- a/spec/features/form/page_routing_spec.rb +++ b/spec/features/form/page_routing_spec.rb @@ -270,6 +270,78 @@ RSpec.describe "Form Page Routing" do expect(lettings_log.form.depends_on_met(depends_on, lettings_log)).to eq(true) end + + describe "using the 'not equal to' operator" do + it "returns true if both values are non-nil and different" do + depends_on = [ + { + "relat2" => { + "operator" => "!=", + "operand" => "P", + }, + }, + ] + lettings_log.relat2 = "X" + + expect(lettings_log.form.depends_on_met(depends_on, lettings_log)).to eq(true) + end + + it "returns false if both values are non-nil and the same" do + depends_on = [ + { + "relat2" => { + "operator" => "!=", + "operand" => "P", + }, + }, + ] + lettings_log.relat2 = "P" + + expect(lettings_log.form.depends_on_met(depends_on, lettings_log)).to eq(false) + end + + it "returns true if the being tested is nil and the operand is non-nil" do + depends_on = [ + { + "relat2" => { + "operator" => "!=", + "operand" => "P", + }, + }, + ] + lettings_log.relat2 = nil + + expect(lettings_log.form.depends_on_met(depends_on, lettings_log)).to eq(true) + end + + it "returns true if the being tested is non-nil and the operand is nil" do + depends_on = [ + { + "relat2" => { + "operator" => "!=", + "operand" => nil, + }, + }, + ] + lettings_log.relat2 = "P" + + expect(lettings_log.form.depends_on_met(depends_on, lettings_log)).to eq(true) + end + + it "returns false if both values are nil" do + depends_on = [ + { + "relat2" => { + "operator" => "!=", + "operand" => nil, + }, + }, + ] + lettings_log.relat2 = nil + + expect(lettings_log.form.depends_on_met(depends_on, lettings_log)).to eq(false) + end + end end end From 691581d19a65f1d1a7c75171c385da13d65ec63d Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Mon, 9 Feb 2026 12:08:01 +0000 Subject: [PATCH 07/17] Improve person_lead_partner tests --- .../pages/person_lead_partner_spec.rb | 80 +++++++++++++++++-- 1 file changed, 72 insertions(+), 8 deletions(-) diff --git a/spec/models/form/lettings/pages/person_lead_partner_spec.rb b/spec/models/form/lettings/pages/person_lead_partner_spec.rb index adff653da..ff4da0bee 100644 --- a/spec/models/form/lettings/pages/person_lead_partner_spec.rb +++ b/spec/models/form/lettings/pages/person_lead_partner_spec.rb @@ -17,10 +17,6 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do end context "with person 2" do - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[relat2]) - end - it "has the correct id" do expect(page.id).to eq("person_2_lead_partner") end @@ -30,6 +26,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do allow(form).to receive(:start_year_2026_or_later?).and_return(false) end + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[relat2]) + end + it "has correct depends_on" do expect(page.depends_on).to eq( [{ "details_known_2" => 0 }], @@ -42,6 +42,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do allow(form).to receive(:start_year_2026_or_later?).and_return(true) end + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[relat2]) + end + it "has correct depends_on" do expect(page.depends_on).to eq( [ @@ -62,10 +66,6 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do context "with person 3" do let(:person_index) { 3 } - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[relat3]) - end - it "has the correct id" do expect(page.id).to eq("person_3_lead_partner") end @@ -75,6 +75,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do allow(form).to receive(:start_year_2026_or_later?).and_return(false) end + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[relat3]) + end + it "has correct depends_on" do expect(page.depends_on).to eq( [{ "details_known_3" => 0 }], @@ -87,6 +91,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do allow(form).to receive(:start_year_2026_or_later?).and_return(true) end + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[relat3]) + end + it "has correct depends_on" do expect(page.depends_on).to eq( [ @@ -108,4 +116,60 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do end end end + + context "with person 4" do + let(:person_index) { 4 } + + it "has the correct id" do + expect(page.id).to eq("person_4_lead_partner") + end + + context "with start year < 2026", metadata: { year: 25 } do + before do + allow(form).to receive(:start_year_2026_or_later?).and_return(false) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[relat4]) + end + + it "has correct depends_on" do + expect(page.depends_on).to eq( + [{ "details_known_4" => 0 }], + ) + end + end + + context "with start year >= 2026", metadata: { year: 26 } do + before do + allow(form).to receive(:start_year_2026_or_later?).and_return(true) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[relat4]) + end + + it "has correct depends_on" do + expect(page.depends_on).to eq( + [ + { + "details_known_4" => 0, + "age4" => { + "operator" => ">=", + "operand" => 16, + }, + "relat2" => { "operator" => "!=", "operand" => "P" }, + "relat3" => { "operator" => "!=", "operand" => "P" }, + }, + { + "details_known_4" => 0, + "age4" => nil, + "relat2" => { "operator" => "!=", "operand" => "P" }, + "relat3" => { "operator" => "!=", "operand" => "P" }, + }, + ], + ) + end + end + end end From 3d5b42e09bf23dc82400cb9a749ce1f6e36841c4 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Mon, 9 Feb 2026 14:56:23 +0000 Subject: [PATCH 08/17] Fix inference logic --- .../derived_variables/lettings_log_variables.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 22541c2e0..5669089e3 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -247,6 +247,17 @@ private if form.start_year_2024_or_later? && (unittype_gn_changed? && unittype_gn_was == 2) self.beds = nil end + if form.start_year_2026_or_later? + (2..8).each do |i| + if send("relat#{i}_changed?") && send("relat#{i}_was") == "P" + (i + 1..8).each do |j| + if self["relat#{j}"] == "X" + self["relat#{j}"] = nil + end + end + end + end + end end def get_totelder @@ -300,7 +311,10 @@ private end def infer_at_most_one_relationship! - if partner_numbers.any? + new_partner_numbers = partner_numbers.select { |i| public_send("relat#{i}_changed?") } + if new_partner_numbers.any? + infer_only_partner!(new_partner_numbers.first) + elsif partner_numbers.any? infer_only_partner!(partner_numbers.first) end end From c0523051f10e40314af77fcee9e75db846c97baa Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Mon, 9 Feb 2026 15:06:28 +0000 Subject: [PATCH 09/17] Revert to simpler inference logic --- app/models/derived_variables/lettings_log_variables.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 5669089e3..1d8d67894 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -311,10 +311,7 @@ private end def infer_at_most_one_relationship! - new_partner_numbers = partner_numbers.select { |i| public_send("relat#{i}_changed?") } - if new_partner_numbers.any? - infer_only_partner!(new_partner_numbers.first) - elsif partner_numbers.any? + if partner_numbers.any? infer_only_partner!(partner_numbers.first) end end From 9e7198860f507aac26bb896f330362975eb5c93f Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Mon, 9 Feb 2026 15:39:44 +0000 Subject: [PATCH 10/17] Correct hidden_in_check_answers logic --- .../form/lettings/questions/person_partner.rb | 15 ++-- .../lettings/questions/person_partner_spec.rb | 80 ++++++++++++++++++- 2 files changed, 86 insertions(+), 9 deletions(-) diff --git a/app/models/form/lettings/questions/person_partner.rb b/app/models/form/lettings/questions/person_partner.rb index 7a09ca8cd..bfebb3723 100644 --- a/app/models/form/lettings/questions/person_partner.rb +++ b/app/models/form/lettings/questions/person_partner.rb @@ -7,11 +7,6 @@ class Form::Lettings::Questions::PersonPartner < ::Form::Question @answer_options = answer_options @person_index = person_index @question_number = question_number - @hidden_in_check_answers = { - "depends_on" => (2...person_index).map do |i| - { "relat#{i}" => "P", "relat#{person_index}" => "X" } - end, - } @disable_clearing_if_not_routed_or_dynamic_answer_options = form.start_year_2026_or_later? end @@ -37,4 +32,14 @@ class Form::Lettings::Questions::PersonPartner < ::Form::Question def derived?(log) form.start_year_2026_or_later? && log.is_partner_inferred?(@person_index) end + + def hidden_in_check_answers?(log, _current_user = nil) + if form.start_year_2026_or_later? + (2...@person_index).any? do |i| + log["relat#{i}"] == "P" + end + else + false + end + end end diff --git a/spec/models/form/lettings/questions/person_partner_spec.rb b/spec/models/form/lettings/questions/person_partner_spec.rb index 9888c3bb0..583ae2610 100644 --- a/spec/models/form/lettings/questions/person_partner_spec.rb +++ b/spec/models/form/lettings/questions/person_partner_spec.rb @@ -122,8 +122,44 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do expect(question.check_answers_card_number).to eq(3) end - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq("relat2" => "P", "relat3" => "X") + context "when the log has a preceding value of `relat` as 'P'" do + let(:log) { build(:lettings_log, relat2: "P") } + + context "and in 2025", metadata: { year: 25 } do + let(:year) { 2025 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(false) + end + end + + context "and in 2026", metadata: { year: 26 } do + let(:year) { 2026 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(true) + end + end + end + + context "when the log does not have a preceding value of `relat` as 'P'" do + let(:log) { build(:lettings_log, relat2: "X") } + + context "and in 2025", metadata: { year: 25 } do + let(:year) { 2025 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(false) + end + end + + context "and in 2026", metadata: { year: 26 } do + let(:year) { 2026 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(false) + end + end end end @@ -138,8 +174,44 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do expect(question.check_answers_card_number).to eq(4) end - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq("depends_on" => [{"relat2"=>"P", "relat4"=>"X"}, {"relat3"=>"P", "relat4"=>"X"}]) + context "when the log has a preceding value of `relat` as 'P'" do + let(:log) { build(:lettings_log, relat2: "P", relat3: "X") } + + context "and in 2025", metadata: { year: 25 } do + let(:year) { 2025 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(false) + end + end + + context "and in 2026", metadata: { year: 26 } do + let(:year) { 2026 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(true) + end + end + end + + context "when the log does not have a preceding value of `relat` as 'P'" do + let(:log) { build(:lettings_log, relat2: "R", relat3: "X") } + + context "and in 2025", metadata: { year: 25 } do + let(:year) { 2025 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(false) + end + end + + context "and in 2026", metadata: { year: 26 } do + let(:year) { 2026 } + + it "has the correct hidden_in_check_answers?" do + expect(question.hidden_in_check_answers?(log)).to eq(false) + end + end end end end From 3647f541dc4053997d79410d5bd3b0a1f74d0445 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Mon, 9 Feb 2026 16:11:32 +0000 Subject: [PATCH 11/17] Fixed derived? --- .../form/lettings/questions/person_partner.rb | 4 +-- app/models/lettings_log.rb | 10 ++++++ .../lettings/questions/person_partner_spec.rb | 32 +++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/app/models/form/lettings/questions/person_partner.rb b/app/models/form/lettings/questions/person_partner.rb index bfebb3723..cb6071614 100644 --- a/app/models/form/lettings/questions/person_partner.rb +++ b/app/models/form/lettings/questions/person_partner.rb @@ -35,9 +35,7 @@ class Form::Lettings::Questions::PersonPartner < ::Form::Question def hidden_in_check_answers?(log, _current_user = nil) if form.start_year_2026_or_later? - (2...@person_index).any? do |i| - log["relat#{i}"] == "P" - end + log.is_an_earlier_person_partner(@person_index) else false end diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index cdd52799b..e7e37b7b6 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -403,9 +403,19 @@ class LettingsLog < Log end def is_partner_inferred?(person_index) + is_person_under_16(person_index) || is_an_earlier_person_partner(person_index) + end + + def is_person_under_16(person_index) public_send("age#{person_index}") && public_send("age#{person_index}") < 16 end + def is_an_earlier_person_partner(person_index) + (2...person_index).any? do |i| + public_send("relat#{i}") == "P" + end + end + def age_changed_from_below_16(person_index) public_send("age#{person_index}_was") && public_send("age#{person_index}_was") < 16 end diff --git a/spec/models/form/lettings/questions/person_partner_spec.rb b/spec/models/form/lettings/questions/person_partner_spec.rb index 583ae2610..435794046 100644 --- a/spec/models/form/lettings/questions/person_partner_spec.rb +++ b/spec/models/form/lettings/questions/person_partner_spec.rb @@ -131,6 +131,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(false) end + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end end context "and in 2026", metadata: { year: 26 } do @@ -139,6 +143,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(true) end + + it "is marked as derived" do + expect(question.derived?(log)).to be true + end end end @@ -151,6 +159,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(false) end + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end end context "and in 2026", metadata: { year: 26 } do @@ -159,6 +171,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(false) end + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end end end end @@ -183,6 +199,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(false) end + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end end context "and in 2026", metadata: { year: 26 } do @@ -191,6 +211,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(true) end + + it "is marked as derived" do + expect(question.derived?(log)).to be true + end end end @@ -203,6 +227,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(false) end + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end end context "and in 2026", metadata: { year: 26 } do @@ -211,6 +239,10 @@ RSpec.describe Form::Lettings::Questions::PersonPartner, type: :model do it "has the correct hidden_in_check_answers?" do expect(question.hidden_in_check_answers?(log)).to eq(false) end + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end end end end From c4b17e489ee76704797f368490a1eb197196ab55 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Tue, 10 Feb 2026 10:09:55 +0000 Subject: [PATCH 12/17] Improve lettings log variables tests --- .../lettings_log_variables.rb | 12 +- .../lettings_log_derived_fields_spec.rb | 179 +++++++++++++----- 2 files changed, 143 insertions(+), 48 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 1d8d67894..ac03fff55 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -248,13 +248,16 @@ private self.beds = nil end if form.start_year_2026_or_later? - (2..8).each do |i| + person_count = hhmemb || 8 + (2..person_count).each do |i| if send("relat#{i}_changed?") && send("relat#{i}_was") == "P" - (i + 1..8).each do |j| + ((i + 1)..person_count).each do |j| if self["relat#{j}"] == "X" self["relat#{j}"] = nil end end + else + next end end end @@ -320,7 +323,10 @@ private other_partner_numbers = partner_numbers.reject { |x| x == partner_number } other_partner_numbers.each { |i| self["relat#{i}"] = "X" } - unanswered_partner_questions = (2..8).select { |i| public_send("relat#{i}").nil? } + return unless hhmemb + + unanswered_partner_questions = (2..hhmemb).select { |i| public_send("relat#{i}").nil? } + unanswered_partner_questions.each { |i| self["relat#{i}"] = "X" } end diff --git a/spec/models/lettings_log_derived_fields_spec.rb b/spec/models/lettings_log_derived_fields_spec.rb index 9c9762e8e..446a789cc 100644 --- a/spec/models/lettings_log_derived_fields_spec.rb +++ b/spec/models/lettings_log_derived_fields_spec.rb @@ -1589,7 +1589,7 @@ RSpec.describe LettingsLog, type: :model do end end - describe "#infer_at_most_one_relationship!" do + describe "At most one relationships inferences" do context "when 2025", metadata: { year: 25 } do before do Timecop.freeze(Time.zone.local(2025, 5, 10)) @@ -1602,25 +1602,44 @@ RSpec.describe LettingsLog, type: :model do end context "when there are no existing relationships" do - let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "X", relat4: "R") } + # `relat2` is "P" by default when creating a lettings log from the factory, so we explicitly set it to `nil`. + let(:log) { create(:lettings_log, :completed, hhmemb: 6, relat2: nil, relat3: "X", relat4: "X", relat5: "R") } it "does not infer no to any relationship answers when a new relationship is added" do - log.relat2 = "P" - expect { log.set_derived_fields! }.to not_change(log, :relat3) - expect { log.set_derived_fields! }.to not_change(log, :relat4) - expect { log.set_derived_fields! }.to not_change(log, :relat5) + log.relat4 = "P" + expect { log.set_derived_fields! } + .to not_change(log, :relat2) + .and not_change(log, :relat3) + .and not_change(log, :relat5) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) end end context "when there is an existing relationship" do - let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "P", relat4: "R", relat5: "X") } + let(:log) { create(:lettings_log, :completed, hhmemb: 6, relat2: "X", relat3: "P", relat4: "R", relat5: "X") } it "does not infer no to any relationship answers when a new relationship is added" do log.relat2 = "P" - expect { log.set_derived_fields! }.to not_change(log, :relat3) - expect { log.set_derived_fields! }.to not_change(log, :relat4) - expect { log.set_derived_fields! }.to not_change(log, :relat5) - expect { log.set_derived_fields! }.to not_change(log, :relat6) + expect { log.set_derived_fields! } + .to not_change(log, :relat3) + .and not_change(log, :relat4) + .and not_change(log, :relat5) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) + end + + it "does not reset any answers when the relationship is removed" do + log.relat3 = "X" + expect { log.set_derived_fields! } + .to not_change(log, :relat2) + .and not_change(log, :relat4) + .and not_change(log, :relat5) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) end end @@ -1628,16 +1647,17 @@ RSpec.describe LettingsLog, type: :model do let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "X", relat4: "R", relat5: "X") } before do - log.relat3 = "P" log.relat2 = "P" + log.relat3 = "P" end it "does not infer no to any relationship answers" do - expect { log.set_derived_fields! }.to not_change(log, :relat2) - expect { log.set_derived_fields! }.to not_change(log, :relat3) - expect { log.set_derived_fields! }.to not_change(log, :relat4) - expect { log.set_derived_fields! }.to not_change(log, :relat5) - expect { log.set_derived_fields! }.to not_change(log, :relat6) + expect { log.set_derived_fields! } + .to not_change(log, :relat4) + .and not_change(log, :relat5) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) end end end @@ -1654,46 +1674,66 @@ RSpec.describe LettingsLog, type: :model do end context "when there are no existing relationships" do - let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "X", relat4: "R") } + # `relat2` is "P" by default when creating a lettings log from the factory, so we explicitly set it to `nil`. + let(:log) { create(:lettings_log, :completed, hhmemb: 6, relat2: nil, relat3: "X", relat4: "X", relat5: "R") } context "and a new relationship is added" do before do - log.relat2 = "P" + log.relat4 = "P" end it "infers no to unanswered questions" do - expect { log.set_derived_fields! }.to change(log, :relat5).to "X" + expect { log.set_derived_fields! } + .to change(log, :relat2).to("X") + .and change(log, :relat6).to("X") + end + + it "does not change relationship answers for people not in the household" do + expect { log.set_derived_fields! } + .to not_change(log, :relat7) + .and not_change(log, :relat8) end it "does not change relationship answers of no or prefer not to say" do - expect { log.set_derived_fields! }.to not_change(log, :relat3) - expect { log.set_derived_fields! }.to not_change(log, :relat4) + expect { log.set_derived_fields! } + .to not_change(log, :relat3) + .and not_change(log, :relat5) end end it "does not change other relationship values if no is changed to prefer not to say" do - log.relat2 = "R" - expect { log.set_derived_fields! }.to not_change(log, :relat3) - expect { log.set_derived_fields! }.to not_change(log, :relat4) + log.relat4 = "R" + expect { log.set_derived_fields! } + .to not_change(log, :relat2) + .and not_change(log, :relat3) + .and not_change(log, :relat5) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) end it "does not change other relationship values if prefer not to say is changed to no" do - log.relat4 = "X" - expect { log.set_derived_fields! }.to not_change(log, :relat2) - expect { log.set_derived_fields! }.to not_change(log, :relat3) + log.relat5 = "X" + expect { log.set_derived_fields! } + .to not_change(log, :relat2) + .and not_change(log, :relat3) + .and not_change(log, :relat4) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) end end context "when there is an existing relationship" do - let(:log) { create(:lettings_log, :completed, relat2: "X", relat3: "P", relat4: "R", relat5: "X") } + let(:log) { create(:lettings_log, :completed, hhmemb: 6, relat2: "X", relat3: "P", relat4: "R", relat5: "X") } - context "and a new relationship is added" do + context "and a new relationship is added to an earlier person than the existing one" do before do - log.relat6 = nil + log.relat6 = nil # This is necessary because `log.set_derived_fields!` runs when the log is created from the factory, which sets `relat6` to "X". log.relat2 = "P" end - it "infers no to the previous relationship" do + it "infers no to the existing relationship" do expect { log.set_derived_fields! }.to change(log, :relat3).to "X" end @@ -1701,18 +1741,59 @@ RSpec.describe LettingsLog, type: :model do expect { log.set_derived_fields! }.to change(log, :relat6).to "X" end + it "does not change relationship answers for people not in the household" do + expect { log.set_derived_fields! } + .to not_change(log, :relat7) + .and not_change(log, :relat8) + end + it "does not change relationship answers of no or prefer not to say" do - expect { log.set_derived_fields! }.to not_change(log, :relat5) - expect { log.set_derived_fields! }.to not_change(log, :relat4) + expect { log.set_derived_fields! } + .to not_change(log, :relat5) + .and not_change(log, :relat4) end end - it "does not change other relationship values if the partner is removed" do - log.relat3 = "X" - expect { log.set_derived_fields! }.to not_change(log, :relat2) - expect { log.set_derived_fields! }.to not_change(log, :relat4) - expect { log.set_derived_fields! }.to not_change(log, :relat5) - expect { log.set_derived_fields! }.to not_change(log, :relat6) + it "does not change other relationship values if no is changed to prefer not to say" do + log.relat2 = "R" + expect { log.set_derived_fields! } + .to not_change(log, :relat3) + .and not_change(log, :relat4) + .and not_change(log, :relat5) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) + end + + it "does not change other relationship values if prefer not to say is changed to no" do + log.relat4 = "X" + expect { log.set_derived_fields! } + .to not_change(log, :relat2) + .and not_change(log, :relat3) + .and not_change(log, :relat5) + .and not_change(log, :relat6) + .and not_change(log, :relat7) + .and not_change(log, :relat8) + end + + context "and the relationship is removed" do + before do + log.relat3 = "X" + end + + it "does not reset answers of no that come before the removed relationship to nil" do + expect { log.set_derived_fields! }.to not_change(log, :relat2) + end + + it "resets answers of no that come after the removed relationship to nil, regardless of whether they were inferred or not" do + expect { log.set_derived_fields! } + .to change(log, :relat5).to(nil) # `relat5` was set to "X" explicitly. + .and change(log, :relat6).to(nil) # `relat6` was inferred as "X" when we created the log from the factory. + end + + it "does not reset answers of prefer not to say" do + expect { log.set_derived_fields! }.to not_change(log, :relat4) + end end end @@ -1720,22 +1801,30 @@ RSpec.describe LettingsLog, type: :model do let(:log) { create(:lettings_log, :completed, hhmemb: 6, relat2: "X", relat3: "X", relat4: "R", relat5: "X") } before do - log.relat3 = "P" log.relat2 = "P" + log.relat3 = "P" end it "keeps the lower numbered relationship and infers the higher numbered one to false" do - expect { log.set_derived_fields! }.to change(log, :relat3).to "X" - expect { log.set_derived_fields! }.to not_change(log, :relat2) + expect { log.set_derived_fields! } + .to not_change(log, :relat2) + .and change(log, :relat3).to("X") end it "infers no to unanswered questions" do expect { log.set_derived_fields! }.to change(log, :relat6).to "X" end + it "does not change relationship answers for people not in the household" do + expect { log.set_derived_fields! } + .to not_change(log, :relat7) + .and not_change(log, :relat8) + end + it "does not change relationship answers of no or prefer not to say" do - expect { log.set_derived_fields! }.to not_change(log, :relat5) - expect { log.set_derived_fields! }.to not_change(log, :relat4) + expect { log.set_derived_fields! } + .to not_change(log, :relat5) + .and not_change(log, :relat4) end end end From 88aefaeac22afc468eaca1ad2613717371ae0506 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Tue, 10 Feb 2026 10:15:40 +0000 Subject: [PATCH 13/17] Pull out resetting partner fields into method --- .../lettings_log_variables.rb | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index ac03fff55..aaa848db0 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -248,18 +248,7 @@ private self.beds = nil end if form.start_year_2026_or_later? - person_count = hhmemb || 8 - (2..person_count).each do |i| - if send("relat#{i}_changed?") && send("relat#{i}_was") == "P" - ((i + 1)..person_count).each do |j| - if self["relat#{j}"] == "X" - self["relat#{j}"] = nil - end - end - else - next - end - end + reset_partner_fields! end end @@ -330,6 +319,21 @@ private unanswered_partner_questions.each { |i| self["relat#{i}"] = "X" } end + def reset_partner_fields! + person_count = hhmemb || 8 + (2..person_count).each do |i| + if send("relat#{i}_changed?") && send("relat#{i}_was") == "P" + ((i + 1)..person_count).each do |j| + if self["relat#{j}"] == "X" + self["relat#{j}"] = nil + end + end + else + next + end + end + end + def household_type return unless totelder && totadult && totchild From 0899fc46fc040e7d07164d4448736441fbe837cd Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Tue, 10 Feb 2026 16:56:58 +0000 Subject: [PATCH 14/17] Convert 'else next' to guard clause --- .../derived_variables/lettings_log_variables.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index aaa848db0..e65eb521d 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -322,14 +322,12 @@ private def reset_partner_fields! person_count = hhmemb || 8 (2..person_count).each do |i| - if send("relat#{i}_changed?") && send("relat#{i}_was") == "P" - ((i + 1)..person_count).each do |j| - if self["relat#{j}"] == "X" - self["relat#{j}"] = nil - end + next unless send("relat#{i}_changed?") && send("relat#{i}_was") == "P" + + ((i + 1)..person_count).each do |j| + if self["relat#{j}"] == "X" + self["relat#{j}"] = nil end - else - next end end end From 7fa78f0e92ab37fdcff70a1b971d5ef7ba9ff5f2 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Tue, 10 Feb 2026 17:28:25 +0000 Subject: [PATCH 15/17] Refactor infer_only_partner! --- .../derived_variables/lettings_log_variables.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index e65eb521d..1f81f61c6 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -309,14 +309,15 @@ private end def infer_only_partner!(partner_number) - other_partner_numbers = partner_numbers.reject { |x| x == partner_number } - other_partner_numbers.each { |i| self["relat#{i}"] = "X" } - return unless hhmemb - unanswered_partner_questions = (2..hhmemb).select { |i| public_send("relat#{i}").nil? } + (2..hhmemb).each do |i| + next if i == partner_number - unanswered_partner_questions.each { |i| self["relat#{i}"] = "X" } + if ["P", nil].include?(public_send("relat#{i}")) + self["relat#{i}"] = "X" + end + end end def reset_partner_fields! From e6030c2994c8bdd4daddccf015732c1da8ab12d3 Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Wed, 11 Feb 2026 11:48:18 +0000 Subject: [PATCH 16/17] Fix after merge --- .../subsections/household_characteristics.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/form/lettings/subsections/household_characteristics.rb b/app/models/form/lettings/subsections/household_characteristics.rb index 64590e1d8..ea9d6d78a 100644 --- a/app/models/form/lettings/subsections/household_characteristics.rb +++ b/app/models/form/lettings/subsections/household_characteristics.rb @@ -45,7 +45,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 2), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_2_under_retirement_value_check", nil, self, person_index: 2), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_2_over_retirement_value_check", nil, self, person_index: 2), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_2_partner_under_16_value_check", nil, self, person_index: 2) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index: 2) if form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 2), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 2), @@ -68,7 +68,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 3), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_3_under_retirement_value_check", nil, self, person_index: 3), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_3_over_retirement_value_check", nil, self, person_index: 3), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_3_partner_under_16_value_check", nil, self, person_index: 3) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index: 3) if form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 3), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 3), @@ -91,7 +91,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 4), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_4_under_retirement_value_check", nil, self, person_index: 4), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_4_over_retirement_value_check", nil, self, person_index: 4), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_4_partner_under_16_value_check", nil, self, person_index: 4) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index: 4) if form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 4), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 4), @@ -114,7 +114,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 5), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_5_under_retirement_value_check", nil, self, person_index: 5), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_5_over_retirement_value_check", nil, self, person_index: 5), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_5_partner_under_16_value_check", nil, self, person_index: 5) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index: 5) if form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 5), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 5), @@ -137,7 +137,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 6), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_6_under_retirement_value_check", nil, self, person_index: 6), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_6_over_retirement_value_check", nil, self, person_index: 6), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_6_partner_under_16_value_check", nil, self, person_index: 6) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index: 6) if form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 6), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 6), @@ -160,7 +160,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 7), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_7_under_retirement_value_check", nil, self, person_index: 7), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_7_over_retirement_value_check", nil, self, person_index: 7), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_7_partner_under_16_value_check", nil, self, person_index: 7) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_7_partner_under_16_value_check", nil, self, person_index: 7) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index: 7) if form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 7), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 7), @@ -183,7 +183,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection person_index: 8), Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_8_under_retirement_value_check", nil, self, person_index: 8), Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_8_over_retirement_value_check", nil, self, person_index: 8), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_8_partner_under_16_value_check", nil, self, person_index: 8) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?), + (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_8_partner_under_16_value_check", nil, self, person_index: 8) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index: 8) if form.start_year_2026_or_later?), Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index: 8), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index: 8), From 3ad111a65f006f85031bc308113247165089047f Mon Sep 17 00:00:00 2001 From: oscar-richardson-softwire Date: Wed, 11 Feb 2026 12:09:44 +0000 Subject: [PATCH 17/17] Fix CSV export tests --- spec/fixtures/files/lettings_log_csv_export_codes_26.csv | 6 +++--- spec/fixtures/files/lettings_log_csv_export_labels_26.csv | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/fixtures/files/lettings_log_csv_export_codes_26.csv b/spec/fixtures/files/lettings_log_csv_export_codes_26.csv index 2c2bb616a..bfd414d76 100644 --- a/spec/fixtures/files/lettings_log_csv_export_codes_26.csv +++ b/spec/fixtures/files/lettings_log_csv_export_codes_26.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,The following soft validation was confirmed: You said that more than one person in the household is the partner of the lead tenant. Are you sure this is correct?,What was person 2's sex at birth?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,"The following soft validation was confirmed: Are you sure? This is a general needs log, and this referral type is for supported housing.",Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? -id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,multiple_partners_value_check,sexrab2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,1,2026,,MHCLG,MHCLG,1,7,0,2026-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,2,6,2,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,7,1,3,2026-03-30,1,,1,2026-03-31,,,3,1,4,,2,4,,1,4,0,0,2,35,,F,F,0,2,36,0,,0,32,P,,M,M,6,1,-9,R,R,R,10,0,-9,R,R,R,10,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,0,,,,0,0,1,268,,6,1,1,,,2,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, +Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,What was person 2's sex at birth?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,"The following soft validation was confirmed: Are you sure? This is a general needs log, and this referral type is for supported housing.",Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? +id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,sexrab2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate +,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,1,2026,,MHCLG,MHCLG,1,7,0,2026-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,2,6,2,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,7,1,3,2026-03-30,1,,1,2026-03-31,,,3,1,4,,2,4,,1,4,0,0,2,35,,F,F,0,2,36,0,,0,32,P,M,M,6,1,-9,R,R,R,10,0,-9,R,R,R,10,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,0,,,,0,0,1,268,,6,1,1,,,2,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_labels_26.csv b/spec/fixtures/files/lettings_log_csv_export_labels_26.csv index f771b4d60..969b38560 100644 --- a/spec/fixtures/files/lettings_log_csv_export_labels_26.csv +++ b/spec/fixtures/files/lettings_log_csv_export_labels_26.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,The following soft validation was confirmed: You said that more than one person in the household is the partner of the lead tenant. Are you sure this is correct?,What was person 2's sex at birth?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,"The following soft validation was confirmed: Are you sure? This is a general needs log, and this referral type is for supported housing.",Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? -id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,multiple_partners_value_check,sexrab2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,single log,2026,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2026-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,Affordable rent basis,Tenant abandoned property,No,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,House,Yes,3,2026-03-30,1,,Yes,2026-03-31,,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,4,,Yes,4,0,0,2,35,,Female,Female,White,Irish,Australia,Other,,Yes,32,Yes,,Male,Male,Not seeking work,No,Not known,Prefers not to say,Prefers not to say,Prefers not to say,Prefers not to say,Yes,Not known,Tenant prefers not to say,Person prefers not to say,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,No,,,,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,,Every 2 weeks,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,, +Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,What was person 2's sex at birth?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,"The following soft validation was confirmed: Are you sure? This is a general needs log, and this referral type is for supported housing.",Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? +id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,sexrab2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate +,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,single log,2026,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2026-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,Affordable rent basis,Tenant abandoned property,No,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,House,Yes,3,2026-03-30,1,,Yes,2026-03-31,,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,4,,Yes,4,0,0,2,35,,Female,Female,White,Irish,Australia,Other,,Yes,32,Yes,Male,Male,Not seeking work,No,Not known,Prefers not to say,Prefers not to say,Prefers not to say,Prefers not to say,Yes,Not known,Tenant prefers not to say,Person prefers not to say,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,No,,,,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,,Every 2 weeks,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,,