From 51bc0cffeb55d1f0c8f4734e4b0cabad241be5e0 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:04:18 +0000 Subject: [PATCH 01/27] CLDC-3665 Extract sale information copy (#2711) * Extract shared ownership copy * Extract discounted ownership copy * rename files * CLDC-3665 Extract sale information soft validations (#2712) * Extract shared ownership copy * Extract shared ownership soft validations * Extract discounted ownership validations * Fix mappings * Update some translations * Remove full stops --- app/helpers/interruption_screen_helper.rb | 1 + .../form/sales/pages/about_staircase.rb | 2 +- app/models/form/sales/pages/buyer_previous.rb | 1 + app/models/form/sales/pages/deposit.rb | 2 +- .../pages/deposit_and_mortgage_value_check.rb | 5 +- .../form/sales/pages/deposit_discount.rb | 2 +- .../form/sales/pages/deposit_value_check.rb | 2 +- app/models/form/sales/pages/discount.rb | 2 +- .../pages/discounted_sale_value_check.rb | 5 +- app/models/form/sales/pages/equity.rb | 2 +- app/models/form/sales/pages/exchange_date.rb | 1 + .../form/sales/pages/extra_borrowing.rb | 2 +- .../pages/extra_borrowing_value_check.rb | 5 +- app/models/form/sales/pages/grant.rb | 2 +- .../form/sales/pages/grant_value_check.rb | 5 +- app/models/form/sales/pages/handover_date.rb | 1 + .../form/sales/pages/handover_date_check.rb | 3 +- app/models/form/sales/pages/la_nominations.rb | 1 + .../form/sales/pages/leasehold_charges.rb | 1 + .../sales/pages/living_before_purchase.rb | 3 +- app/models/form/sales/pages/monthly_rent.rb | 1 + .../form/sales/pages/mortgage_amount.rb | 2 +- .../form/sales/pages/mortgage_lender.rb | 2 +- .../form/sales/pages/mortgage_lender_other.rb | 2 +- .../form/sales/pages/mortgage_length.rb | 1 + app/models/form/sales/pages/mortgageused.rb | 2 +- .../form/sales/pages/previous_bedrooms.rb | 2 +- .../sales/pages/previous_property_type.rb | 2 +- .../form/sales/pages/previous_tenure.rb | 1 + app/models/form/sales/pages/purchase_price.rb | 2 +- .../purchase_price_outright_ownership.rb | 12 +- app/models/form/sales/pages/resale.rb | 1 + .../shared_ownership_deposit_value_check.rb | 4 +- app/models/form/sales/pages/staircase.rb | 1 + .../pages/staircase_bought_value_check.rb | 5 +- .../pages/staircase_owned_value_check.rb | 7 +- .../sales/pages/value_shared_ownership.rb | 2 +- .../form/sales/questions/buyer_previous.rb | 3 +- .../form/sales/questions/deposit_amount.rb | 11 +- .../deposit_and_mortgage_value_check.rb | 3 +- .../form/sales/questions/deposit_discount.rb | 4 +- .../sales/questions/deposit_value_check.rb | 6 +- app/models/form/sales/questions/discount.rb | 6 +- .../questions/discounted_sale_value_check.rb | 3 +- app/models/form/sales/questions/equity.rb | 4 +- .../form/sales/questions/exchange_date.rb | 3 +- .../form/sales/questions/extra_borrowing.rb | 4 +- .../questions/extra_borrowing_value_check.rb | 3 +- app/models/form/sales/questions/fromprop.rb | 4 +- app/models/form/sales/questions/grant.rb | 4 +- .../form/sales/questions/grant_value_check.rb | 3 +- .../form/sales/questions/handover_date.rb | 4 +- .../sales/questions/handover_date_check.rb | 3 +- .../sales/questions/has_leasehold_charges.rb | 4 +- .../form/sales/questions/la_nominations.rb | 4 +- .../form/sales/questions/leasehold_charges.rb | 3 +- .../sales/questions/living_before_purchase.rb | 4 +- .../questions/living_before_purchase_years.rb | 22 +- .../form/sales/questions/monthly_rent.rb | 4 +- .../form/sales/questions/mortgage_amount.rb | 4 +- .../form/sales/questions/mortgage_lender.rb | 4 +- .../sales/questions/mortgage_lender_other.rb | 3 +- .../form/sales/questions/mortgage_length.rb | 4 +- .../form/sales/questions/mortgageused.rb | 3 +- .../form/sales/questions/previous_bedrooms.rb | 4 +- .../form/sales/questions/previous_tenure.rb | 4 +- .../form/sales/questions/purchase_price.rb | 14 +- app/models/form/sales/questions/resale.rb | 4 +- .../shared_ownership_deposit_value_check.rb | 3 +- app/models/form/sales/questions/staircase.rb | 4 +- .../form/sales/questions/staircase_bought.rb | 3 +- .../questions/staircase_bought_value_check.rb | 3 +- .../form/sales/questions/staircase_owned.rb | 3 +- .../questions/staircase_owned_value_check.rb | 7 +- .../form/sales/questions/staircase_sale.rb | 3 +- app/models/form/sales/questions/value.rb | 4 +- config/locales/en.yml | 41 ---- .../forms/2023/sales/sale_information.en.yml | 208 ++++++++++++++++++ .../forms/2023/sales/soft_validations.en.yml | 130 ++++++++--- .../forms/2024/sales/sale_information.en.yml | 207 +++++++++++++++++ .../forms/2024/sales/soft_validations.en.yml | 133 ++++++++--- .../subsections/tenancy_information_spec.rb | 2 +- .../pages/discounted_sale_value_check_spec.rb | 7 +- .../sales/pages/handover_date_check_spec.rb | 5 +- ...ared_ownership_deposit_value_check_spec.rb | 9 +- .../pages/staircase_owned_value_check_spec.rb | 9 +- .../questions/deposit_value_check_spec.rb | 2 +- .../living_before_purchase_years_spec.rb | 2 +- .../staircase_owned_value_check_spec.rb | 2 +- 89 files changed, 754 insertions(+), 283 deletions(-) create mode 100644 config/locales/forms/2023/sales/sale_information.en.yml create mode 100644 config/locales/forms/2024/sales/sale_information.en.yml diff --git a/app/helpers/interruption_screen_helper.rb b/app/helpers/interruption_screen_helper.rb index b28c7eaa9..7d9a38ddf 100644 --- a/app/helpers/interruption_screen_helper.rb +++ b/app/helpers/interruption_screen_helper.rb @@ -1,6 +1,7 @@ module InterruptionScreenHelper def display_informative_text(informative_text, log) return informative_text if informative_text.is_a? String + return "" if informative_text.nil? return "" unless informative_text["arguments"] translation_params = {} diff --git a/app/models/form/sales/pages/about_staircase.rb b/app/models/form/sales/pages/about_staircase.rb index 4d5882916..d736bae15 100644 --- a/app/models/form/sales/pages/about_staircase.rb +++ b/app/models/form/sales/pages/about_staircase.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::AboutStaircase < ::Form::Page def initialize(id, hsh, subsection, joint_purchase:) super(id, hsh, subsection) @joint_purchase = joint_purchase - @header = "About the staircasing transaction" + @copy_key = "sales.sale_information.about_staircasing" @depends_on = [{ "staircase" => 1, "joint_purchase?" => joint_purchase, diff --git a/app/models/form/sales/pages/buyer_previous.rb b/app/models/form/sales/pages/buyer_previous.rb index 87f87b66b..0d20207a3 100644 --- a/app/models/form/sales/pages/buyer_previous.rb +++ b/app/models/form/sales/pages/buyer_previous.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::BuyerPrevious < ::Form::Page def initialize(id, hsh, subsection, joint_purchase:) super(id, hsh, subsection) @joint_purchase = joint_purchase + @copy_key = "sales.sale_information.soctenant.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @depends_on = [{ "joint_purchase?" => joint_purchase, "soctenant_is_inferred?" => false }] end diff --git a/app/models/form/sales/pages/deposit.rb b/app/models/form/sales/pages/deposit.rb index 3e298e4f6..f0bbda05c 100644 --- a/app/models/form/sales/pages/deposit.rb +++ b/app/models/form/sales/pages/deposit.rb @@ -3,7 +3,7 @@ class Form::Sales::Pages::Deposit < ::Form::Page super(id, hsh, subsection) @ownershipsch = ownershipsch @optional = optional - @header = "About the deposit" + @copy_key = "sales.sale_information.deposit" end def questions diff --git a/app/models/form/sales/pages/deposit_and_mortgage_value_check.rb b/app/models/form/sales/pages/deposit_and_mortgage_value_check.rb index fe5ad4acb..142c79cb5 100644 --- a/app/models/form/sales/pages/deposit_and_mortgage_value_check.rb +++ b/app/models/form/sales/pages/deposit_and_mortgage_value_check.rb @@ -6,8 +6,9 @@ class Form::Sales::Pages::DepositAndMortgageValueCheck < ::Form::Page "mortgage_plus_deposit_less_than_discounted_value?" => true, }, ] + @copy_key = "sales.soft_validations.deposit_and_mortgage_value_check" @title_text = { - "translation" => "soft_validations.deposit_and_mortgage.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "mortgage", @@ -27,7 +28,7 @@ class Form::Sales::Pages::DepositAndMortgageValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.deposit_and_mortgage.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/sales/pages/deposit_discount.rb b/app/models/form/sales/pages/deposit_discount.rb index 6931a7510..caf726460 100644 --- a/app/models/form/sales/pages/deposit_discount.rb +++ b/app/models/form/sales/pages/deposit_discount.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::DepositDiscount < ::Form::Page def initialize(id, hsh, subsection, optional:) super(id, hsh, subsection) @optional = optional - @header = "About the deposit" + @copy_key = "sales.sale_information.cashdis" end def questions diff --git a/app/models/form/sales/pages/deposit_value_check.rb b/app/models/form/sales/pages/deposit_value_check.rb index cbec4b031..fea99b28b 100644 --- a/app/models/form/sales/pages/deposit_value_check.rb +++ b/app/models/form/sales/pages/deposit_value_check.rb @@ -26,7 +26,7 @@ class Form::Sales::Pages::DepositValueCheck < ::Form::Page def questions @questions ||= [ - Form::Sales::Questions::DepositValueCheck.new(nil, nil, self), + Form::Sales::Questions::DepositValueCheck.new(nil, nil, self, joint_purchase: @joint_purchase), ] end diff --git a/app/models/form/sales/pages/discount.rb b/app/models/form/sales/pages/discount.rb index 56670075b..2d632985e 100644 --- a/app/models/form/sales/pages/discount.rb +++ b/app/models/form/sales/pages/discount.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::Discount < ::Form::Page def initialize(id, hsh, subsection) super @id = "discount" - @header = "About the price of the property" + @copy_key = "sales.sale_information.discount" @depends_on = [{ "right_to_buy?" => true, }] diff --git a/app/models/form/sales/pages/discounted_sale_value_check.rb b/app/models/form/sales/pages/discounted_sale_value_check.rb index dcb820e49..4fbff90c6 100644 --- a/app/models/form/sales/pages/discounted_sale_value_check.rb +++ b/app/models/form/sales/pages/discounted_sale_value_check.rb @@ -2,8 +2,9 @@ class Form::Sales::Pages::DiscountedSaleValueCheck < ::Form::Page def initialize(id, hsh, subsection, person_index = nil) super(id, hsh, subsection) @depends_on = depends_on + @copy_key = "sales.soft_validations.discounted_sale_value_check" @title_text = { - "translation" => "soft_validations.discounted_sale_value.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "field_formatted_as_currency", @@ -13,7 +14,7 @@ class Form::Sales::Pages::DiscountedSaleValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.discounted_sale_value.informative_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [ { "key" => "field_formatted_as_currency", diff --git a/app/models/form/sales/pages/equity.rb b/app/models/form/sales/pages/equity.rb index 018ba6f79..9bf3050a0 100644 --- a/app/models/form/sales/pages/equity.rb +++ b/app/models/form/sales/pages/equity.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::Equity < ::Form::Page def initialize(id, hsh, subsection) super @id = "equity" - @header = "About the price of the property" + @copy_key = "sales.sale_information.equity" end def questions diff --git a/app/models/form/sales/pages/exchange_date.rb b/app/models/form/sales/pages/exchange_date.rb index ec71b0647..4317c39e0 100644 --- a/app/models/form/sales/pages/exchange_date.rb +++ b/app/models/form/sales/pages/exchange_date.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::ExchangeDate < ::Form::Page def initialize(id, hsh, subsection) super @id = "exchange_contracts" + @copy_key = "sales.sale_information.exchange_date" @depends_on = [{ "resale" => 2, }] diff --git a/app/models/form/sales/pages/extra_borrowing.rb b/app/models/form/sales/pages/extra_borrowing.rb index 4bb8d0530..c6ddb705a 100644 --- a/app/models/form/sales/pages/extra_borrowing.rb +++ b/app/models/form/sales/pages/extra_borrowing.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::ExtraBorrowing < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @ownershipsch = ownershipsch - @header = "" + @copy_key = "sales.sale_information.extrabor" @description = "" @subsection = subsection @depends_on = [{ diff --git a/app/models/form/sales/pages/extra_borrowing_value_check.rb b/app/models/form/sales/pages/extra_borrowing_value_check.rb index b3cf0b2db..9fc621611 100644 --- a/app/models/form/sales/pages/extra_borrowing_value_check.rb +++ b/app/models/form/sales/pages/extra_borrowing_value_check.rb @@ -6,8 +6,9 @@ class Form::Sales::Pages::ExtraBorrowingValueCheck < Form::Page "extra_borrowing_expected_but_not_reported?" => true, }, ] + @copy_key = "sales.soft_validations.extra_borrowing_value_check" @title_text = { - "translation" => "soft_validations.extra_borrowing.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "field_formatted_as_currency", @@ -17,7 +18,7 @@ class Form::Sales::Pages::ExtraBorrowingValueCheck < Form::Page ], } @informative_text = { - "translation" => "soft_validations.extra_borrowing.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/sales/pages/grant.rb b/app/models/form/sales/pages/grant.rb index 7c7d2a625..2f96701c5 100644 --- a/app/models/form/sales/pages/grant.rb +++ b/app/models/form/sales/pages/grant.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::Grant < ::Form::Page def initialize(id, hsh, subsection) super @id = "grant" - @header = "About the price of the property" + @copy_key = "sales.sale_information.grant" @depends_on = [{ "right_to_buy?" => false, "rent_to_buy_full_ownership?" => false, diff --git a/app/models/form/sales/pages/grant_value_check.rb b/app/models/form/sales/pages/grant_value_check.rb index 6b53d74ee..0c5d50901 100644 --- a/app/models/form/sales/pages/grant_value_check.rb +++ b/app/models/form/sales/pages/grant_value_check.rb @@ -2,13 +2,14 @@ class Form::Sales::Pages::GrantValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "grant_value_check" + @copy_key = "sales.soft_validations.grant_value_check" @depends_on = [ { "grant_outside_common_range?" => true, }, ] @title_text = { - "translation" => "soft_validations.grant.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "field_formatted_as_currency", @@ -18,7 +19,7 @@ class Form::Sales::Pages::GrantValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.grant.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/sales/pages/handover_date.rb b/app/models/form/sales/pages/handover_date.rb index 35fbe7822..c40effc8e 100644 --- a/app/models/form/sales/pages/handover_date.rb +++ b/app/models/form/sales/pages/handover_date.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::HandoverDate < ::Form::Page def initialize(id, hsh, subsection) super @id = "handover_date" + @copy_key = "sales.sale_information.handover_date" @depends_on = [ { "ownershipsch" => 1, "resale" => 2 }, ] diff --git a/app/models/form/sales/pages/handover_date_check.rb b/app/models/form/sales/pages/handover_date_check.rb index e8d666f60..690c3dde7 100644 --- a/app/models/form/sales/pages/handover_date_check.rb +++ b/app/models/form/sales/pages/handover_date_check.rb @@ -2,11 +2,12 @@ class Form::Sales::Pages::HandoverDateCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "handover_date_check" + @copy_key = "sales.soft_validations.hodate_check" @depends_on = [{ "saledate_check" => nil, "hodate_3_years_or_more_saledate?" => true }, { "saledate_check" => 1, "hodate_3_years_or_more_saledate?" => true }] @informative_text = {} @title_text = { - "translation" => "soft_validations.hodate.must_be_less_than_3_years_from_saledate", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [], } end diff --git a/app/models/form/sales/pages/la_nominations.rb b/app/models/form/sales/pages/la_nominations.rb index fc3f39f6a..6adda533d 100644 --- a/app/models/form/sales/pages/la_nominations.rb +++ b/app/models/form/sales/pages/la_nominations.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::LaNominations < ::Form::Page def initialize(id, hsh, subsection) super @id = "la_nominations" + @copy_key = "sales.sale_information.la_nominations" end def questions diff --git a/app/models/form/sales/pages/leasehold_charges.rb b/app/models/form/sales/pages/leasehold_charges.rb index a8ce52805..72b2eeea3 100644 --- a/app/models/form/sales/pages/leasehold_charges.rb +++ b/app/models/form/sales/pages/leasehold_charges.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::LeaseholdCharges < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @ownershipsch = ownershipsch + @copy_key = "sales.sale_information.leaseholdcharges" end def questions diff --git a/app/models/form/sales/pages/living_before_purchase.rb b/app/models/form/sales/pages/living_before_purchase.rb index c5dd64330..3bb5510ce 100644 --- a/app/models/form/sales/pages/living_before_purchase.rb +++ b/app/models/form/sales/pages/living_before_purchase.rb @@ -3,12 +3,13 @@ class Form::Sales::Pages::LivingBeforePurchase < ::Form::Page super(id, hsh, subsection) @ownershipsch = ownershipsch @joint_purchase = joint_purchase + @copy_key = "sales.sale_information.living_before_purchase.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" end def questions @questions ||= [ living_before_purchase, - Form::Sales::Questions::LivingBeforePurchaseYears.new(nil, nil, self, ownershipsch: @ownershipsch), + Form::Sales::Questions::LivingBeforePurchaseYears.new(nil, nil, self, ownershipsch: @ownershipsch, joint_purchase: @joint_purchase), ].compact end diff --git a/app/models/form/sales/pages/monthly_rent.rb b/app/models/form/sales/pages/monthly_rent.rb index 29f0d895f..943e47cff 100644 --- a/app/models/form/sales/pages/monthly_rent.rb +++ b/app/models/form/sales/pages/monthly_rent.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::MonthlyRent < ::Form::Page def initialize(id, hsh, subsection) super @id = "monthly_rent" + @copy_key = "sales.sale_information.mrent" end def questions diff --git a/app/models/form/sales/pages/mortgage_amount.rb b/app/models/form/sales/pages/mortgage_amount.rb index 73e306c2a..41fba167c 100644 --- a/app/models/form/sales/pages/mortgage_amount.rb +++ b/app/models/form/sales/pages/mortgage_amount.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::MortgageAmount < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @ownershipsch = ownershipsch - @header = "Mortgage Amount" + @copy_key = "sales.sale_information.mortgage" @depends_on = [{ "mortgage_used?" => true }] end diff --git a/app/models/form/sales/pages/mortgage_lender.rb b/app/models/form/sales/pages/mortgage_lender.rb index f187815b1..87646a514 100644 --- a/app/models/form/sales/pages/mortgage_lender.rb +++ b/app/models/form/sales/pages/mortgage_lender.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::MortgageLender < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @ownershipsch = ownershipsch - @header = "" + @copy_key = "sales.sale_information.mortgagelender" @description = "" @subsection = subsection @depends_on = [{ diff --git a/app/models/form/sales/pages/mortgage_lender_other.rb b/app/models/form/sales/pages/mortgage_lender_other.rb index 903a7dba8..903d6518f 100644 --- a/app/models/form/sales/pages/mortgage_lender_other.rb +++ b/app/models/form/sales/pages/mortgage_lender_other.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::MortgageLenderOther < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @ownershipsch = ownershipsch - @header = "" + @copy_key = "sales.sale_information.mortgagelenderother" @description = "" @subsection = subsection @depends_on = [{ diff --git a/app/models/form/sales/pages/mortgage_length.rb b/app/models/form/sales/pages/mortgage_length.rb index dbc01a695..76c46694a 100644 --- a/app/models/form/sales/pages/mortgage_length.rb +++ b/app/models/form/sales/pages/mortgage_length.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::MortgageLength < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @ownershipsch = ownershipsch + @copy_key = "sales.sale_information.mortlen" @depends_on = [{ "mortgageused" => 1, }] diff --git a/app/models/form/sales/pages/mortgageused.rb b/app/models/form/sales/pages/mortgageused.rb index a4912b12d..ab48b0c2d 100644 --- a/app/models/form/sales/pages/mortgageused.rb +++ b/app/models/form/sales/pages/mortgageused.rb @@ -1,7 +1,7 @@ class Form::Sales::Pages::Mortgageused < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) - @header = "Mortgage Amount" + @copy_key = "sales.sale_information.mortgageused" @ownershipsch = ownershipsch end diff --git a/app/models/form/sales/pages/previous_bedrooms.rb b/app/models/form/sales/pages/previous_bedrooms.rb index 722822c2d..26b3ef050 100644 --- a/app/models/form/sales/pages/previous_bedrooms.rb +++ b/app/models/form/sales/pages/previous_bedrooms.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::PreviousBedrooms < ::Form::Page def initialize(id, hsh, subsection) super @id = "previous_bedrooms" - @header = "About the buyers’ previous property" + @copy_key = "sales.sale_information.frombeds" @depends_on = [ { "soctenant" => 1, diff --git a/app/models/form/sales/pages/previous_property_type.rb b/app/models/form/sales/pages/previous_property_type.rb index 8c46963d0..c5dd4f66a 100644 --- a/app/models/form/sales/pages/previous_property_type.rb +++ b/app/models/form/sales/pages/previous_property_type.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::PreviousPropertyType < ::Form::Page def initialize(id, hsh, subsection) super @id = "previous_property_type" - @header = "" + @copy_key = "sales.sale_information.fromprop" @description = "" @subsection = subsection @depends_on = [ diff --git a/app/models/form/sales/pages/previous_tenure.rb b/app/models/form/sales/pages/previous_tenure.rb index 0f4a4b250..c35b6bd67 100644 --- a/app/models/form/sales/pages/previous_tenure.rb +++ b/app/models/form/sales/pages/previous_tenure.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::PreviousTenure < ::Form::Page def initialize(id, hsh, subsection) super @id = "shared_ownership_previous_tenure" + @copy_key = "sales.sale_information.socprevten" @header = "" @description = "" @subsection = subsection diff --git a/app/models/form/sales/pages/purchase_price.rb b/app/models/form/sales/pages/purchase_price.rb index 2203375ef..0bb1da53e 100644 --- a/app/models/form/sales/pages/purchase_price.rb +++ b/app/models/form/sales/pages/purchase_price.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::PurchasePrice < ::Form::Page def initialize(id, hsh, subsection) super @id = "purchase_price" - @header = "About the price of the property" + @copy_key = "sales.sale_information.purchase_price.discounted_ownership" @depends_on = [{ "right_to_buy?" => true }, { "right_to_buy?" => false, diff --git a/app/models/form/sales/pages/purchase_price_outright_ownership.rb b/app/models/form/sales/pages/purchase_price_outright_ownership.rb index 897a19c2e..ea42a7001 100644 --- a/app/models/form/sales/pages/purchase_price_outright_ownership.rb +++ b/app/models/form/sales/pages/purchase_price_outright_ownership.rb @@ -4,11 +4,21 @@ class Form::Sales::Pages::PurchasePriceOutrightOwnership < ::Form::Page @depends_on = [ { "outright_sale_or_discounted_with_full_ownership?" => true }, ] - @header = "About the price of the property" @top_guidance_partial = "financial_calculations_outright_sale" @ownershipsch = ownershipsch end + def copy_key + case @ownershipsch + when 1 + "sales.sale_information.purchase_price.shared_ownership" + when 2 + "sales.sale_information.purchase_price.discounted_ownership" + when 3 + "sales.sale_information.purchase_price.outright_sale" + end + end + def questions @questions ||= [ Form::Sales::Questions::PurchasePrice.new(nil, nil, self, ownershipsch: @ownershipsch), diff --git a/app/models/form/sales/pages/resale.rb b/app/models/form/sales/pages/resale.rb index ffdbbc046..6f4cd24e2 100644 --- a/app/models/form/sales/pages/resale.rb +++ b/app/models/form/sales/pages/resale.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::Resale < ::Form::Page def initialize(id, hsh, subsection) super @id = "resale" + @copy_key = "sales.sale_information.resale" @depends_on = [ { "staircase" => 2, diff --git a/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb b/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb index bc8df6743..e56db3e38 100644 --- a/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb +++ b/app/models/form/sales/pages/shared_ownership_deposit_value_check.rb @@ -6,9 +6,9 @@ class Form::Sales::Pages::SharedOwnershipDepositValueCheck < ::Form::Page "shared_ownership_deposit_invalid?" => true, }, ] - @informative_text = {} + @copy_key = "sales.soft_validations.shared_ownership_deposit_value_check" @title_text = { - "translation" => "soft_validations.shared_ownership_deposit.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "mortgage_deposit_and_discount_error_fields", diff --git a/app/models/form/sales/pages/staircase.rb b/app/models/form/sales/pages/staircase.rb index 6ab76e2bf..28b0d6b38 100644 --- a/app/models/form/sales/pages/staircase.rb +++ b/app/models/form/sales/pages/staircase.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::Staircase < ::Form::Page def initialize(id, hsh, subsection) super @id = "staircasing" + @copy_key = "sales.sale_information.staircasing" end def questions diff --git a/app/models/form/sales/pages/staircase_bought_value_check.rb b/app/models/form/sales/pages/staircase_bought_value_check.rb index 283261a53..3b505f3cc 100644 --- a/app/models/form/sales/pages/staircase_bought_value_check.rb +++ b/app/models/form/sales/pages/staircase_bought_value_check.rb @@ -7,8 +7,9 @@ class Form::Sales::Pages::StaircaseBoughtValueCheck < ::Form::Page "staircase_bought_above_fifty?" => true, }, ] + @copy_key = "sales.soft_validations.staircase_bought_value_check" @title_text = { - "translation" => "soft_validations.staircase_bought_seems_high.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "stairbought", @@ -17,7 +18,7 @@ class Form::Sales::Pages::StaircaseBoughtValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.staircase_bought_seems_high.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/sales/pages/staircase_owned_value_check.rb b/app/models/form/sales/pages/staircase_owned_value_check.rb index d83bf7d5d..1a26215e3 100644 --- a/app/models/form/sales/pages/staircase_owned_value_check.rb +++ b/app/models/form/sales/pages/staircase_owned_value_check.rb @@ -8,8 +8,9 @@ class Form::Sales::Pages::StaircaseOwnedValueCheck < ::Form::Page "joint_purchase?" => joint_purchase, }, ] + @copy_key = "sales.soft_validations.stairowned_value_check.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @title_text = { - "translation" => joint_purchase ? "soft_validations.staircase_owned.title_text.two" : "soft_validations.staircase_owned.title_text.one", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "stairowned", @@ -19,14 +20,14 @@ class Form::Sales::Pages::StaircaseOwnedValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.staircase_owned.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end def questions @questions ||= [ - Form::Sales::Questions::StaircaseOwnedValueCheck.new(nil, nil, self), + Form::Sales::Questions::StaircaseOwnedValueCheck.new(nil, nil, self, joint_purchase: @joint_purchase), ] end diff --git a/app/models/form/sales/pages/value_shared_ownership.rb b/app/models/form/sales/pages/value_shared_ownership.rb index a4f6dbe1c..c2212c787 100644 --- a/app/models/form/sales/pages/value_shared_ownership.rb +++ b/app/models/form/sales/pages/value_shared_ownership.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::ValueSharedOwnership < ::Form::Page def initialize(id, hsh, subsection) super @id = "value_shared_ownership" - @header = "About the price of the property" + @copy_key = "sales.sale_information.value" end def questions diff --git a/app/models/form/sales/questions/buyer_previous.rb b/app/models/form/sales/questions/buyer_previous.rb index b35a67c5e..dfc0c2fd2 100644 --- a/app/models/form/sales/questions/buyer_previous.rb +++ b/app/models/form/sales/questions/buyer_previous.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::BuyerPrevious < ::Form::Question def initialize(id, hsh, page, joint_purchase:) super(id, hsh, page) @id = "soctenant" - @check_answer_label = I18n.t("check_answer_labels.soctenant", count: joint_purchase ? 2 : 1) - @header = I18n.t("questions.soctenant", count: joint_purchase ? 2 : 1) + @copy_key = "sales.sale_information.soctenant.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @type = "radio" @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] diff --git a/app/models/form/sales/questions/deposit_amount.rb b/app/models/form/sales/questions/deposit_amount.rb index c1d91cc12..41586cd94 100644 --- a/app/models/form/sales/questions/deposit_amount.rb +++ b/app/models/form/sales/questions/deposit_amount.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:, optional:) super(id, hsh, subsection) @id = "deposit" - @check_answer_label = "Cash deposit" - @header = "How much cash deposit was paid on the property?" + @copy_key = "sales.sale_information.deposit" @type = "numeric" @min = 0 @max = 999_999 @@ -25,14 +24,6 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question 2024 => { 1 => 96, 2 => 109, 3 => 116 }, }.freeze - def hint_text - if @optional - "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage. This excludes any grant or loan. As this is a fully staircased sale this question is optional. If you do not have the information available click save and continue" - else - "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage. This excludes any grant or loan" - end - end - def top_guidance_partial return "financial_calculations_shared_ownership" if @ownershipsch == 1 return "financial_calculations_discounted_ownership" if @ownershipsch == 2 diff --git a/app/models/form/sales/questions/deposit_and_mortgage_value_check.rb b/app/models/form/sales/questions/deposit_and_mortgage_value_check.rb index 263cf4342..3a60e2afa 100644 --- a/app/models/form/sales/questions/deposit_and_mortgage_value_check.rb +++ b/app/models/form/sales/questions/deposit_and_mortgage_value_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::DepositAndMortgageValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "deposit_and_mortgage_value_check" - @check_answer_label = "Deposit and mortgage against discount confirmation" - @header = "Are you sure? Mortgage and deposit usually equal or are more than (value - discount)" + @copy_key = "sales.soft_validations.deposit_and_mortgage_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/deposit_discount.rb b/app/models/form/sales/questions/deposit_discount.rb index faf8d76f7..289e3962c 100644 --- a/app/models/form/sales/questions/deposit_discount.rb +++ b/app/models/form/sales/questions/deposit_discount.rb @@ -2,15 +2,13 @@ class Form::Sales::Questions::DepositDiscount < ::Form::Question def initialize(id, hsh, page) super @id = "cashdis" - @check_answer_label = "Cash discount through SocialHomeBuy" - @header = "How much cash discount was given through Social HomeBuy?" + @copy_key = "sales.sale_information.cashdis" @type = "numeric" @min = 0 @max = 999_999 @step = 1 @width = 5 @prefix = "£" - @hint_text = "Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @top_guidance_partial = "financial_calculations_shared_ownership" end diff --git a/app/models/form/sales/questions/deposit_value_check.rb b/app/models/form/sales/questions/deposit_value_check.rb index f8d403d9c..71560fa84 100644 --- a/app/models/form/sales/questions/deposit_value_check.rb +++ b/app/models/form/sales/questions/deposit_value_check.rb @@ -1,8 +1,8 @@ class Form::Sales::Questions::DepositValueCheck < ::Form::Question - def initialize(id, hsh, page) - super + def initialize(id, hsh, page, joint_purchase:) + super(id, hsh, page) @id = "deposit_value_check" - @copy_key = "sales.soft_validations.deposit_value_check" + @copy_key = "sales.soft_validations.deposit_value_check.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/discount.rb b/app/models/form/sales/questions/discount.rb index f99203ebe..1d8c5a46b 100644 --- a/app/models/form/sales/questions/discount.rb +++ b/app/models/form/sales/questions/discount.rb @@ -2,17 +2,13 @@ class Form::Sales::Questions::Discount < ::Form::Question def initialize(id, hsh, page) super @id = "discount" - @check_answer_label = "Percentage discount" - @header = "What was the percentage discount?" @type = "numeric" + @copy_key = "sales.sale_information.discount" @min = 0 @max = form.start_year_after_2024? ? 70 : 100 @step = 0.1 @width = 5 @suffix = "%" - @hint_text = "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)

- If discount capped, enter capped %

- If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @top_guidance_partial = "financial_calculations_discounted_ownership" end diff --git a/app/models/form/sales/questions/discounted_sale_value_check.rb b/app/models/form/sales/questions/discounted_sale_value_check.rb index 1d86b2f32..a02aaac72 100644 --- a/app/models/form/sales/questions/discounted_sale_value_check.rb +++ b/app/models/form/sales/questions/discounted_sale_value_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::DiscountedSaleValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "discounted_sale_value_check" - @check_answer_label = "Discounted sale value confirmation" - @header = "Are you sure this is correct?" + @copy_key = "sales.soft_validations.discounted_sale_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/equity.rb b/app/models/form/sales/questions/equity.rb index 2e1ad4dee..dd1a14227 100644 --- a/app/models/form/sales/questions/equity.rb +++ b/app/models/form/sales/questions/equity.rb @@ -2,15 +2,13 @@ class Form::Sales::Questions::Equity < ::Form::Question def initialize(id, hsh, page) super @id = "equity" - @check_answer_label = "Initial percentage equity stake" - @header = "What was the initial percentage equity stake purchased?" + @copy_key = "sales.sale_information.equity" @type = "numeric" @min = 0 @max = 100 @step = 1 @width = 5 @suffix = "%" - @hint_text = "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @top_guidance_partial = "financial_calculations_shared_ownership" end diff --git a/app/models/form/sales/questions/exchange_date.rb b/app/models/form/sales/questions/exchange_date.rb index 8e9dd4691..a29a7a6c7 100644 --- a/app/models/form/sales/questions/exchange_date.rb +++ b/app/models/form/sales/questions/exchange_date.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::ExchangeDate < ::Form::Question def initialize(id, hsh, page) super @id = "exdate" - @check_answer_label = "Exchange of contracts date" - @header = "What is the exchange of contracts date?" + @copy_key = "sales.sale_information.exchange_date" @type = "date" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/sales/questions/extra_borrowing.rb b/app/models/form/sales/questions/extra_borrowing.rb index 2b4303423..e3cd0ff7e 100644 --- a/app/models/form/sales/questions/extra_borrowing.rb +++ b/app/models/form/sales/questions/extra_borrowing.rb @@ -2,12 +2,10 @@ class Form::Sales::Questions::ExtraBorrowing < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "extrabor" - @check_answer_label = "Any other borrowing?" - @header = "Does this include any extra borrowing?" + @copy_key = "sales.sale_information.extrabor" @type = "radio" @answer_options = ANSWER_OPTIONS @page = page - @hint_text = "" @ownershipsch = ownershipsch @question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] end diff --git a/app/models/form/sales/questions/extra_borrowing_value_check.rb b/app/models/form/sales/questions/extra_borrowing_value_check.rb index 0f12ce110..7a251fab8 100644 --- a/app/models/form/sales/questions/extra_borrowing_value_check.rb +++ b/app/models/form/sales/questions/extra_borrowing_value_check.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::ExtraBorrowingValueCheck < ::Form::Question def initialize(id, hsh, page) super(id, hsh, page) @id = "extrabor_value_check" - @check_answer_label = "Extra borrowing confirmation" + @copy_key = "sales.soft_validations.extra_borrowing_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, @@ -18,6 +18,5 @@ class Form::Sales::Questions::ExtraBorrowingValueCheck < ::Form::Question }, ], } - @header = "Are you sure there is no extra borrowing?" end end diff --git a/app/models/form/sales/questions/fromprop.rb b/app/models/form/sales/questions/fromprop.rb index ec17e5939..1a3393b7a 100644 --- a/app/models/form/sales/questions/fromprop.rb +++ b/app/models/form/sales/questions/fromprop.rb @@ -2,10 +2,8 @@ class Form::Sales::Questions::Fromprop < ::Form::Question def initialize(id, hsh, page) super @id = "fromprop" - @check_answer_label = "Previous property type" - @header = "What was the previous property type?" + @copy_key = "sales.sale_information.fromprop" @type = "radio" - @hint_text = "" @page = page @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] diff --git a/app/models/form/sales/questions/grant.rb b/app/models/form/sales/questions/grant.rb index 45b70d61f..17361fe9c 100644 --- a/app/models/form/sales/questions/grant.rb +++ b/app/models/form/sales/questions/grant.rb @@ -2,15 +2,13 @@ class Form::Sales::Questions::Grant < ::Form::Question def initialize(id, hsh, page) super @id = "grant" - @check_answer_label = "Amount of any loan, grant or subsidy" - @header = "What was the amount of any loan, grant, discount or subsidy given?" + @copy_key = "sales.sale_information.grant" @type = "numeric" @min = 0 @max = 999_999 @step = 1 @width = 5 @prefix = "£" - @hint_text = "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @top_guidance_partial = "financial_calculations_discounted_ownership" end diff --git a/app/models/form/sales/questions/grant_value_check.rb b/app/models/form/sales/questions/grant_value_check.rb index a7efdbaee..63dbb7bac 100644 --- a/app/models/form/sales/questions/grant_value_check.rb +++ b/app/models/form/sales/questions/grant_value_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::GrantValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "grant_value_check" - @check_answer_label = "Grant value confirmation" - @header = "Are you sure? Grants are usually £9,000 - £16,000" + @copy_key = "sales.soft_validations.grant_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/handover_date.rb b/app/models/form/sales/questions/handover_date.rb index 5fb55e5c8..8994ecc40 100644 --- a/app/models/form/sales/questions/handover_date.rb +++ b/app/models/form/sales/questions/handover_date.rb @@ -2,10 +2,8 @@ class Form::Sales::Questions::HandoverDate < ::Form::Question def initialize(id, hsh, page) super @id = "hodate" - @check_answer_label = "Practical completion or handover date" - @header = "What is the practical completion or handover date?" + @copy_key = "sales.sale_information.handover_date" @type = "date" - @hint_text = "This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP)" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/sales/questions/handover_date_check.rb b/app/models/form/sales/questions/handover_date_check.rb index f19ee0196..233c449bb 100644 --- a/app/models/form/sales/questions/handover_date_check.rb +++ b/app/models/form/sales/questions/handover_date_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::HandoverDateCheck < ::Form::Question def initialize(id, hsh, page) super @id = "hodate_check" - @check_answer_label = "Practical completion or handover date check" - @header = "Are you sure?" + @copy_key = "sales.soft_validations.hodate_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/has_leasehold_charges.rb b/app/models/form/sales/questions/has_leasehold_charges.rb index 3e021daa0..fced1d3da 100644 --- a/app/models/form/sales/questions/has_leasehold_charges.rb +++ b/app/models/form/sales/questions/has_leasehold_charges.rb @@ -2,9 +2,7 @@ class Form::Sales::Questions::HasLeaseholdCharges < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "has_mscharge" - @check_answer_label = "Does the property have any monthly leasehold charges?" - @header = "Does the property have any monthly leasehold charges?" - @hint_text = "For example, service and management charges" + @copy_key = "sales.sale_information.leaseholdcharges.has_mscharge" @type = "radio" @answer_options = ANSWER_OPTIONS @conditional_for = { diff --git a/app/models/form/sales/questions/la_nominations.rb b/app/models/form/sales/questions/la_nominations.rb index 0d6e9e249..34540677f 100644 --- a/app/models/form/sales/questions/la_nominations.rb +++ b/app/models/form/sales/questions/la_nominations.rb @@ -2,11 +2,9 @@ class Form::Sales::Questions::LaNominations < ::Form::Question def initialize(id, hsh, page) super @id = "lanomagr" - @check_answer_label = "Household rehoused under a local authority nominations agreement?" - @header = "Was the household rehoused under a 'local authority nominations agreement'?" + @copy_key = "sales.sale_information.la_nominations" @type = "radio" @answer_options = ANSWER_OPTIONS - @hint_text = "A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/sales/questions/leasehold_charges.rb b/app/models/form/sales/questions/leasehold_charges.rb index 2561ccc1d..73d57b1e4 100644 --- a/app/models/form/sales/questions/leasehold_charges.rb +++ b/app/models/form/sales/questions/leasehold_charges.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::LeaseholdCharges < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "mscharge" - @check_answer_label = "Monthly leasehold charges" - @header = "Enter the total monthly charge" + @copy_key = "sales.sale_information.leaseholdcharges.mscharge" @type = "numeric" @min = 1 @step = 0.01 diff --git a/app/models/form/sales/questions/living_before_purchase.rb b/app/models/form/sales/questions/living_before_purchase.rb index 9f28d61ee..c4337e38d 100644 --- a/app/models/form/sales/questions/living_before_purchase.rb +++ b/app/models/form/sales/questions/living_before_purchase.rb @@ -2,9 +2,7 @@ class Form::Sales::Questions::LivingBeforePurchase < ::Form::Question def initialize(id, hsh, page, ownershipsch:, joint_purchase:) super(id, hsh, page) @id = "proplen_asked" - @check_answer_label = "#{joint_purchase ? 'Buyers' : 'Buyer'} lived in the property before purchasing" - @header = "Did the #{joint_purchase ? 'buyers' : 'buyer'} live in the property before purchasing it?" - @hint_text = nil + @copy_key = "sales.sale_information.living_before_purchase.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}.proplen_asked" @type = "radio" @answer_options = ANSWER_OPTIONS @conditional_for = { diff --git a/app/models/form/sales/questions/living_before_purchase_years.rb b/app/models/form/sales/questions/living_before_purchase_years.rb index 4ef92a46c..465ba9877 100644 --- a/app/models/form/sales/questions/living_before_purchase_years.rb +++ b/app/models/form/sales/questions/living_before_purchase_years.rb @@ -1,10 +1,8 @@ class Form::Sales::Questions::LivingBeforePurchaseYears < ::Form::Question - def initialize(id, hsh, page, ownershipsch:) + def initialize(id, hsh, page, ownershipsch:, joint_purchase:) super(id, hsh, page) @id = "proplen" - @check_answer_label = "Number of years living in the property before purchase" - @header = header_text - @hint_text = hint_text + @copy_key = "sales.sale_information.living_before_purchase.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}.proplen" @type = "numeric" @min = 0 @max = 80 @@ -14,22 +12,6 @@ class Form::Sales::Questions::LivingBeforePurchaseYears < ::Form::Question @question_number = question_number end - def header_text - if form.start_date.year >= 2023 - "How long did they live there?" - else - "How long did the buyer(s) live in the property before purchase?" - end - end - - def hint_text - if form.start_date.year >= 2023 - "You should round up to the nearest year" - else - "You should round this up to the nearest year. If the buyers haven't been living in the property, enter '0'" - end - end - def suffix_label(log) " #{'year'.pluralize(log[id])}" end diff --git a/app/models/form/sales/questions/monthly_rent.rb b/app/models/form/sales/questions/monthly_rent.rb index c53f1b7e6..7e64d8571 100644 --- a/app/models/form/sales/questions/monthly_rent.rb +++ b/app/models/form/sales/questions/monthly_rent.rb @@ -2,14 +2,12 @@ class Form::Sales::Questions::MonthlyRent < ::Form::Question def initialize(id, hsh, page) super @id = "mrent" - @check_answer_label = "Monthly rent" - @header = "What is the basic monthly rent?" + @copy_key = "sales.sale_information.mrent" @type = "numeric" @min = 0 @step = 0.01 @width = 5 @prefix = "£" - @hint_text = "Amount paid before any charges" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/sales/questions/mortgage_amount.rb b/app/models/form/sales/questions/mortgage_amount.rb index cfd031f27..a6ffcf26a 100644 --- a/app/models/form/sales/questions/mortgage_amount.rb +++ b/app/models/form/sales/questions/mortgage_amount.rb @@ -2,14 +2,12 @@ class Form::Sales::Questions::MortgageAmount < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "mortgage" - @check_answer_label = "Mortgage amount" - @header = "What is the mortgage amount?" + @copy_key = "sales.sale_information.mortgage" @type = "numeric" @min = 1 @step = 1 @width = 5 @prefix = "£" - @hint_text = "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." @ownershipsch = ownershipsch @question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] @top_guidance_partial = top_guidance_partial diff --git a/app/models/form/sales/questions/mortgage_lender.rb b/app/models/form/sales/questions/mortgage_lender.rb index bf4c93b55..c5a10efb4 100644 --- a/app/models/form/sales/questions/mortgage_lender.rb +++ b/app/models/form/sales/questions/mortgage_lender.rb @@ -2,10 +2,8 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "mortgagelender" - @check_answer_label = "Mortgage Lender" - @header = "What is the name of the mortgage lender?" + @copy_key = "sales.sale_information.mortgagelender" @type = "select" - @hint_text = "" @page = page @bottom_guidance_partial = "mortgage_lender" @ownershipsch = ownershipsch diff --git a/app/models/form/sales/questions/mortgage_lender_other.rb b/app/models/form/sales/questions/mortgage_lender_other.rb index 677b1c117..49876efb0 100644 --- a/app/models/form/sales/questions/mortgage_lender_other.rb +++ b/app/models/form/sales/questions/mortgage_lender_other.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::MortgageLenderOther < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "mortgagelenderother" - @check_answer_label = "Other Mortgage Lender" - @header = "What is the other mortgage lender?" + @copy_key = "sales.sale_information.mortgagelenderother" @type = "text" @page = page @ownershipsch = ownershipsch diff --git a/app/models/form/sales/questions/mortgage_length.rb b/app/models/form/sales/questions/mortgage_length.rb index e1bda4ea0..877818b98 100644 --- a/app/models/form/sales/questions/mortgage_length.rb +++ b/app/models/form/sales/questions/mortgage_length.rb @@ -2,14 +2,12 @@ class Form::Sales::Questions::MortgageLength < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "mortlen" - @check_answer_label = "Length of mortgage" - @header = "What is the length of the mortgage?" + @copy_key = "sales.sale_information.mortlen" @type = "numeric" @min = 0 @max = 60 @step = 1 @width = 5 - @hint_text = "You should round up to the nearest year. Value should not exceed 60 years." @ownershipsch = ownershipsch @question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] end diff --git a/app/models/form/sales/questions/mortgageused.rb b/app/models/form/sales/questions/mortgageused.rb index 4ece2544e..341d3ff60 100644 --- a/app/models/form/sales/questions/mortgageused.rb +++ b/app/models/form/sales/questions/mortgageused.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::Mortgageused < ::Form::Question def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) @id = "mortgageused" - @check_answer_label = "Mortgage used" - @header = "Was a mortgage used for the purchase of this property?" + @copy_key = "sales.sale_information.mortgageused" @type = "radio" @answer_options = ANSWER_OPTIONS @ownershipsch = ownershipsch diff --git a/app/models/form/sales/questions/previous_bedrooms.rb b/app/models/form/sales/questions/previous_bedrooms.rb index 50970bc89..d29da208a 100644 --- a/app/models/form/sales/questions/previous_bedrooms.rb +++ b/app/models/form/sales/questions/previous_bedrooms.rb @@ -2,14 +2,12 @@ class Form::Sales::Questions::PreviousBedrooms < ::Form::Question def initialize(id, hsh, page) super @id = "frombeds" - @check_answer_label = "Number of bedrooms in previous property" - @header = "How many bedrooms did the property have?" + @copy_key = "sales.sale_information.frombeds" @type = "numeric" @width = 5 @min = 1 @max = 6 @step = 1 - @hint_text = "For bedsits enter 1" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/sales/questions/previous_tenure.rb b/app/models/form/sales/questions/previous_tenure.rb index 7227fa00e..55b103f0d 100644 --- a/app/models/form/sales/questions/previous_tenure.rb +++ b/app/models/form/sales/questions/previous_tenure.rb @@ -2,10 +2,8 @@ class Form::Sales::Questions::PreviousTenure < ::Form::Question def initialize(id, hsh, page) super @id = "socprevten" - @check_answer_label = "Previous property tenure" - @header = "What was the previous tenure of the buyer?" + @copy_key = "sales.sale_information.socprevten" @type = "radio" - @hint_text = "" @page = page @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] diff --git a/app/models/form/sales/questions/purchase_price.rb b/app/models/form/sales/questions/purchase_price.rb index 3a9bd4ee7..44497b727 100644 --- a/app/models/form/sales/questions/purchase_price.rb +++ b/app/models/form/sales/questions/purchase_price.rb @@ -2,14 +2,11 @@ class Form::Sales::Questions::PurchasePrice < ::Form::Question def initialize(id, hsh, page, ownershipsch:) super(id, hsh, page) @id = "value" - @check_answer_label = "Purchase price" - @header = "What is the full purchase price?" @type = "numeric" @min = 0 @step = 0.01 @width = 5 @prefix = "£" - @hint_text = hint_text @ownership_sch = ownershipsch @question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] @top_guidance_partial = top_guidance_partial @@ -20,10 +17,13 @@ class Form::Sales::Questions::PurchasePrice < ::Form::Question 2024 => { 2 => 101, 3 => 111 }, }.freeze - def hint_text - return if @ownership_sch == 3 # outright sale - - "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount" + def copy_key + case @ownership_sch + when 2 + "sales.sale_information.purchase_price.discounted_ownership" + when 3 + "sales.sale_information.purchase_price.outright_sale" + end end def top_guidance_partial diff --git a/app/models/form/sales/questions/resale.rb b/app/models/form/sales/questions/resale.rb index be4e5535d..0026adb48 100644 --- a/app/models/form/sales/questions/resale.rb +++ b/app/models/form/sales/questions/resale.rb @@ -2,11 +2,9 @@ class Form::Sales::Questions::Resale < ::Form::Question def initialize(id, hsh, page) super @id = "resale" - @check_answer_label = "Is this a resale?" - @header = "Is this a resale?" + @copy_key = "sales.sale_information.resale" @type = "radio" @answer_options = ANSWER_OPTIONS - @hint_text = "If the social landlord has previously sold the property to another buyer and is now reselling the property, select 'yes'. If this is the first time the property has been sold, select 'no'." @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/sales/questions/shared_ownership_deposit_value_check.rb b/app/models/form/sales/questions/shared_ownership_deposit_value_check.rb index 3f8111881..e7f520b43 100644 --- a/app/models/form/sales/questions/shared_ownership_deposit_value_check.rb +++ b/app/models/form/sales/questions/shared_ownership_deposit_value_check.rb @@ -2,9 +2,8 @@ class Form::Sales::Questions::SharedOwnershipDepositValueCheck < ::Form::Questio def initialize(id, hsh, page) super @id = "shared_ownership_deposit_value_check" - @check_answer_label = "Shared ownership deposit confirmation" + @copy_key = "sales.soft_validations.shared_ownership_deposit_value_check" @type = "interruption_screen" - @header = "Are you sure this is correct?" @answer_options = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" }, diff --git a/app/models/form/sales/questions/staircase.rb b/app/models/form/sales/questions/staircase.rb index 1eb84bfb5..9fc969735 100644 --- a/app/models/form/sales/questions/staircase.rb +++ b/app/models/form/sales/questions/staircase.rb @@ -2,11 +2,9 @@ class Form::Sales::Questions::Staircase < ::Form::Question def initialize(id, hsh, page) super @id = "staircase" - @check_answer_label = "Staircasing transaction" - @header = "Is this a staircasing transaction?" + @copy_key = "sales.sale_information.staircasing" @type = "radio" @answer_options = ANSWER_OPTIONS - @hint_text = "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/sales/questions/staircase_bought.rb b/app/models/form/sales/questions/staircase_bought.rb index 0a6343db4..8a3e88347 100644 --- a/app/models/form/sales/questions/staircase_bought.rb +++ b/app/models/form/sales/questions/staircase_bought.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::StaircaseBought < ::Form::Question def initialize(id, hsh, page) super @id = "stairbought" - @check_answer_label = "Percentage bought in this staircasing transaction" - @header = "What percentage of the property has been bought in this staircasing transaction?" + @copy_key = "sales.sale_information.about_staircasing.stairbought" @type = "numeric" @width = 5 @min = 0 diff --git a/app/models/form/sales/questions/staircase_bought_value_check.rb b/app/models/form/sales/questions/staircase_bought_value_check.rb index 65fe02e66..146e89dfd 100644 --- a/app/models/form/sales/questions/staircase_bought_value_check.rb +++ b/app/models/form/sales/questions/staircase_bought_value_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::StaircaseBoughtValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "staircase_bought_value_check" - @check_answer_label = "Percentage bought confirmation" - @header = "Are you sure this is correct?" + @copy_key = "sales.soft_validations.staircase_bought_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/staircase_owned.rb b/app/models/form/sales/questions/staircase_owned.rb index 64614e608..dc8daaf20 100644 --- a/app/models/form/sales/questions/staircase_owned.rb +++ b/app/models/form/sales/questions/staircase_owned.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::StaircaseOwned < ::Form::Question def initialize(id, hsh, page, joint_purchase:) super(id, hsh, page) @id = "stairowned" - @check_answer_label = I18n.t("check_answer_labels.stairowned", count: joint_purchase ? 2 : 1) - @header = I18n.t("questions.stairowned", count: joint_purchase ? 2 : 1) + @copy_key = "sales.sale_information.about_staircasing.stairowned.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @type = "numeric" @width = 5 @min = 0 diff --git a/app/models/form/sales/questions/staircase_owned_value_check.rb b/app/models/form/sales/questions/staircase_owned_value_check.rb index eb742b196..3457d60fe 100644 --- a/app/models/form/sales/questions/staircase_owned_value_check.rb +++ b/app/models/form/sales/questions/staircase_owned_value_check.rb @@ -1,9 +1,8 @@ class Form::Sales::Questions::StaircaseOwnedValueCheck < ::Form::Question - def initialize(id, hsh, page) - super + def initialize(id, hsh, page, joint_purchase:) + super(id, hsh, page) @id = "stairowned_value_check" - @check_answer_label = "Percentage owned confirmation" - @header = "Are you sure?" + @copy_key = "sales.soft_validations.stairowned_value_check.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/staircase_sale.rb b/app/models/form/sales/questions/staircase_sale.rb index de1c8305a..ac54084f5 100644 --- a/app/models/form/sales/questions/staircase_sale.rb +++ b/app/models/form/sales/questions/staircase_sale.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::StaircaseSale < ::Form::Question def initialize(id, hsh, page) super @id = "staircasesale" - @check_answer_label = "Part of a back-to-back staircasing transaction" - @header = "Is this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?" + @copy_key = "sales.sale_information.about_staircasing.staircasesale" @type = "radio" @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] diff --git a/app/models/form/sales/questions/value.rb b/app/models/form/sales/questions/value.rb index 3ec96e76e..257344fa2 100644 --- a/app/models/form/sales/questions/value.rb +++ b/app/models/form/sales/questions/value.rb @@ -2,14 +2,12 @@ class Form::Sales::Questions::Value < ::Form::Question def initialize(id, hsh, page) super @id = "value" - @check_answer_label = "Full purchase price" - @header = "What was the full purchase price?" + @copy_key = "sales.sale_information.value" @type = "numeric" @min = 0 @step = 1 @width = 5 @prefix = "£" - @hint_text = "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @top_guidance_partial = "financial_calculations_shared_ownership" end diff --git a/config/locales/en.yml b/config/locales/en.yml index 4ef35d19e..52e2c18e9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -605,12 +605,6 @@ en: outside_range_title: "You told us the rent is %{brent}." informative_text: "This is %{higher_or_lower} than we would expect." hint_text: "Check the following:" - staircase_owned: - title_text: - one: "You told us that the buyer now owns %{stairowned} of the property." - two: "You told us that the buyers now own %{stairowned} of the property." - hint_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. -Make sure these answers are correct." retirement: min: title: "You told us this person is aged %{age} years and retired." @@ -618,9 +612,6 @@ Make sure these answers are correct." max: title: "You told us this person is over 66 and not retired." hint_text: "The minimum expected retirement age in England is 66." - extra_borrowing: - title_text: "You told us that the mortgage and deposit total is %{mortgage_and_deposit_total}." - hint_text: "This is higher than the purchase price minus the discount." pregnancy: title: "You told us somebody in the household is pregnant." all_male_tenants: "You also told us that all the tenants living at the property are male." @@ -631,19 +622,6 @@ Make sure these answers are correct." void_date: title_text: "You told us that the property has been vacant for more than 2 years." hint_text: "This is higher than we would expect." - shared_ownership_deposit: - title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}." - staircase_bought_seems_high: - title_text: "You told us that %{percentage}% was bought in this staircasing transaction." - hint_text: "Most staircasing transactions are less than 50%" - discounted_sale_value: - title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}." - informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}." - care_home_charges: - title_text: "Care home charges should be provided if this is a care home accommodation." - grant: - title_text: "You told us that the grant amount is %{grant}." - hint_text: "Loans, grants and subsidies are usually between £9,000 and £16,000." referral: title_text: "Are you sure?" hint_text: "This is a general needs log, and this referral type is for supported housing." @@ -656,16 +634,11 @@ Make sure these answers are correct." charges: informative_text: "This is higher than we would expect." hint_text: "Check the following:" - deposit_and_mortgage: - title_text: "You told us the mortgage amount was %{mortgage}, the cash deposit was %{deposit} and the discount was %{discount}." - hint_text: "We would expect the mortgage amount and the deposit added together to be the same as the purchase price minus the discount." reasonother: title_text: "You told us that the tenant’s main reason for leaving their last settled home was %{reasonother}." informative_text: "The reason you have entered looks very similar to one of the existing response categories. Please check the categories and select the appropriate one. If the existing categories are not suitable, please confirm here to move onto the next question." - hodate: - must_be_less_than_3_years_from_saledate: "You told us practical completion or handover date is more than 3 years before sale completion date." saledate: must_be_less_than_3_years_from_hodate: "You told us sale completion date is more than 3 years after practical completion or handover date." partner_under_16_lettings: @@ -703,12 +676,6 @@ Make sure these answers are correct." W: "Suitable for someone who uses a wheelchair and offers the full use of all rooms and facilities." A: "Fitted with stairlifts, ramps, level access showers or grab rails." N: "Not designed to wheelchair-user standards or fitted with any equipment or adaptations." - soctenant: - one: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" - other: "Were any of the buyers private registered providers, housing association or local authority tenants immediately before this sale?" - stairowned: - one: "What percentage of the property does the buyer now own in total?" - other: "What percentage of the property do the buyers now own in total?" hints: location: @@ -722,14 +689,6 @@ Make sure these answers are correct." bulk_upload: needstype: "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes." - check_answer_labels: - soctenant: - one: "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?" - other: "Any buyers were registered providers, housing association or local authority tenants immediately before this sale?" - stairowned: - one: "Percentage the buyer now owns in total." - other: "Percentage the buyers now own in total." - warnings: organisation: deactivate: "All schemes and users at this organisation will be deactivated. All the organisation's relationships will be removed. It will no longer be possible to create logs for this organisation." diff --git a/config/locales/forms/2023/sales/sale_information.en.yml b/config/locales/forms/2023/sales/sale_information.en.yml new file mode 100644 index 000000000..318d7c7db --- /dev/null +++ b/config/locales/forms/2023/sales/sale_information.en.yml @@ -0,0 +1,208 @@ +en: + forms: + 2023: + sales: + sale_information: + living_before_purchase: + joint_purchase: + page_header: "" + proplen: + check_answer_label: "Number of years living in the property before purchase" + hint_text: "You should round up to the nearest year" + question_text: "How long did they live there?" + proplen_asked: + check_answer_label: "Buyers lived in the property before purchasing" + hint_text: "" + question_text: "Did the buyers live in the property before purchasing it?" + not_joint_purchase: + page_header: "" + proplen: + check_answer_label: "Number of years living in the property before purchase" + hint_text: "You should round up to the nearest year" + question_text: "How long did they live there?" + proplen_asked: + check_answer_label: "Buyer lived in the property before purchasing" + hint_text: "" + question_text: "Did the buyer live in the property before purchasing it?" + + staircasing: + page_header: "" + check_answer_label: "Staircasing transaction" + hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" + question_text: "Is this a staircasing transaction?" + about_staircasing: + page_header: "About the staircasing transaction" + stairbought: + check_answer_label: "Percentage bought in this staircasing transaction" + hint_text: "" + question_text: "What percentage of the property has been bought in this staircasing transaction?" + stairowned: + joint_purchase: + check_answer_label: "Percentage the buyers now own in total" + hint_text: "" + question_text: "What percentage of the property do the buyers now own in total?" + not_joint_purchase: + check_answer_label: "Percentage the buyer now owns in total" + hint_text: "" + question_text: "What percentage of the property does the buyer now own in total?" + + resale: + page_header: "" + check_answer_label: "Is this a resale?" + hint_text: "If the social landlord has previously sold the property to another buyer and is now reselling the property, select 'yes'. If this is the first time the property has been sold, select 'no'." + question_text: "Is this a resale?" + + exchange_date: + page_header: "" + check_answer_label: "Exchange of contracts date" + hint_text: "" + question_text: "What is the exchange of contracts date?" + + handover_date: + page_header: "" + check_answer_label: "Practical completion or handover date" + hint_text: "This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP)" + question_text: "What is the practical completion or handover date?" + + la_nominations: + page_header: "" + check_answer_label: "Household rehoused under a local authority nominations agreement?" + hint_text: "A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing" + question_text: "Was the household rehoused under a 'local authority nominations agreement'?" + + soctenant: + joint_purchase: + page_header: "" + check_answer_label: "Any buyers were registered providers, housing association or local authority tenants immediately before this sale?" + hint_text: "" + question_text: "Were any of the buyers private registered providers, housing association or local authority tenants immediately before this sale?" + not_joint_purchase: + page_header: "" + check_answer_label: "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?" + hint_text: "" + question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" + + frombeds: + page_header: "About the buyers’ previous property" + check_answer_label: "Number of bedrooms in previous property" + hint_text: "For bedsits enter 1" + question_text: "How many bedrooms did the property have?" + + fromprop: + page_header: "" + check_answer_label: "Previous property type" + hint_text: "" + question_text: "What was the previous property type?" + + socprevten: + page_header: "" + check_answer_label: "Previous property tenure" + hint_text: "" + question_text: "What was the previous tenure of the buyer?" + + value: + page_header: "About the price of the property" + check_answer_label: "Full purchase price" + hint_text: "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)" + question_text: "What was the full purchase price?" + + equity: + page_header: "About the price of the property" + check_answer_label: "Initial percentage equity stake" + hint_text: "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" + question_text: "What was the initial percentage equity stake purchased?" + + mortgageused: + page_header: "Mortgage Amount" + check_answer_label: "Mortgage used" + hint_text: "" + question_text: "Was a mortgage used for the purchase of this property?" + + mortgage: + page_header: "Mortgage Amount" + check_answer_label: "Mortgage amount" + hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." + question_text: "What is the mortgage amount?" + + mortgagelender: + page_header: "" + check_answer_label: "Mortgage lender" + hint_text: "" + question_text: "What is the name of the mortgage lender?" + + mortgagelenderother: + page_header: "" + check_answer_label: "Other Mortgage Lender" + hint_text: "" + question_text: "What is the other mortgage lender?" + + mortlen: + page_header: "" + check_answer_label: "Length of mortgage" + hint_text: "You should round up to the nearest year. Value should not exceed 60 years." + question_text: "What is the length of the mortgage?" + + extrabor: + page_header: "" + check_answer_label: "Any other borrowing?" + hint_text: "" + question_text: "Does this include any extra borrowing?" + + deposit: + page_header: "About the deposit" + check_answer_label: "Deposit amount" + hint_text: "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage. This excludes any grant or loan" + question_text: "How much cash deposit was paid on the property?" + + cashdis: + page_header: "About the deposit" + check_answer_label: "Cash discount through SocialHomeBuy" + hint_text: "Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme" + question_text: "How much cash discount was given through Social HomeBuy?" + + mrent: + page_header: "" + check_answer_label: "Monthly rent" + hint_text: "Amount paid before any charges" + question_text: "What is the basic monthly rent?" + + leaseholdcharges: + page_header: "" + has_mscharge: + check_answer_label: "Does the property have any monthly leasehold charges?" + hint_text: "For example, service and management charges" + question_text: "Does the property have any monthly leasehold charges?" + mscharge: + check_answer_label: "Monthly leasehold charges" + hint_text: "" + question_text: "Enter the total monthly charge" + + purchase_price: + shared_ownership: + page_header: "About the price of the property" + check_answer_label: "Purchase price" + hint_text: "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount" + question_text: "What is the full purchase price?" + discounted_ownership: + page_header: "About the price of the property" + check_answer_label: "Purchase price" + hint_text: "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount" + question_text: "What is the full purchase price?" + outright_sale: + page_header: "About the price of the property" + check_answer_label: "Purchase price" + hint_text: "" + question_text: "What is the full purchase price?" + + discount: + page_header: "About the price of the property" + check_answer_label: "Percentage discount" + hint_text: "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)

If discount capped, enter capped %

If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." + question_text: "What was the percentage discount?" + + grant: + page_header: "About the price of the property" + check_answer_label: "Amount of any loan, grant or subsidy" + hint_text: "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy" + question_text: "What was the amount of any loan, grant, discount or subsidy given?" + \ No newline at end of file diff --git a/config/locales/forms/2023/sales/soft_validations.en.yml b/config/locales/forms/2023/sales/soft_validations.en.yml index 1c3cd4955..20f131e90 100644 --- a/config/locales/forms/2023/sales/soft_validations.en.yml +++ b/config/locales/forms/2023/sales/soft_validations.en.yml @@ -40,7 +40,7 @@ en: max: page_header: "" title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?" - + income2_value_check: check_answer_label: "Buyer 2 income confirmation" hint_text: "" @@ -60,14 +60,6 @@ en: question_text: "Are you sure this is correct?" title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?" - value_value_check: - page_header: "" - check_answer_label: "Purchase price confirmation" - hint_text: "" - question_text: "Are you sure?" - title_text: "You told us the purchase price is %{value}." - informative_text: "This is %{higher_or_lower} than we would expect." - mortgage_value_check: page_header: "" check_answer_label: "Mortgage confirmation" @@ -76,22 +68,6 @@ en: title_text: "You told us that the mortgage amount is %{mortgage}." informative_text: "This is more than 5 times the income, which is higher than we would expect." - monthly_charges_value_check: - page_header: "" - check_answer_label: "Monthly charges confirmation" - hint_text: "" - question_text: "Are you sure this is correct?" - title_text: "You told us that the monthly charges were %{mscharge}." - informative_text: "This is higher than we would expect." - - percentage_discount_value_check: - page_header: "" - check_answer_label: "Percentage discount confirmation" - hint_text: "" - question_text: "Are you sure this is correct?" - title_text: "You told us that the percentage discount is %{discount}." - informative_text: "This is higher than we would expect." - savings_value_check: page_header: "" check_answer_label: "Savings confirmation" @@ -104,15 +80,65 @@ en: title_text: "You told us the buyer’s savings were %{savings}." informative_text: "This is higher than we would expect." - deposit_value_check: + staircase_bought_value_check: page_header: "" - check_answer_label: "Deposit confirmation" + check_answer_label: "Percentage bought confirmation" hint_text: "" - question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" + question_text: "Are you sure this is correct?" + title_text: "You told us that %{percentage}% was bought in this staircasing transaction." + informative_text: "Most staircasing transactions are less than 50%" + + stairowned_value_check: joint_purchase: + page_header: "" + check_answer_label: "Percentage owned confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us that the buyers now own %{stairowned} of the property." + informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct." + not_joint_purchase: + page_header: "" + check_answer_label: "Percentage owned confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us that the buyer now owns %{stairowned} of the property." + informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct." + + hodate_check: + page_header: "" + check_answer_label: "Practical completion or handover date check" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us practical completion or handover date is more than 3 years before sale completion date." + + value_value_check: + page_header: "" + check_answer_label: "Purchase price confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us the purchase price is %{value}." + informative_text: "This is %{higher_or_lower} than we would expect." + + shared_ownership_deposit_value_check: + page_header: "" + check_answer_label: "Shared ownership deposit confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}." + + deposit_value_check: + joint_purchase: + page_header: "" + check_answer_label: "Deposit confirmation" + hint_text: "" + question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" title_text: "You told us the buyers’ deposit was %{deposit} and their savings were %{savings}." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." not_joint_purchase: + page_header: "" + check_answer_label: "Deposit confirmation" + hint_text: "" + question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." @@ -162,3 +188,51 @@ en: question_text: "Are you sure this is correct?" title_text: "You told us there are more than 1 persons with 'Partner' relationship to buyer 1." informative_text: "Are you sure this is correct?" + + monthly_charges_value_check: + page_header: "" + check_answer_label: "Monthly charges confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the monthly charges were %{mscharge}." + informative_text: "This is higher than we would expect." + + extra_borrowing_value_check: + page_header: "" + check_answer_label: "Extra borrowing confirmation" + hint_text: "" + question_text: "Are you sure there is no extra borrowing?" + title_text: "You told us that the mortgage and deposit total is %{mortgage_and_deposit_total}." + informative_text: "This is higher than the purchase price minus the discount." + + percentage_discount_value_check: + page_header: "" + check_answer_label: "Percentage discount confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the percentage discount is %{discount}." + informative_text: "This is higher than we would expect." + + grant_value_check: + page_header: "" + check_answer_label: "Grant value confirmation" + hint_text: "" + question_text: "Are you sure? Grants are usually £9,000 - £16,000" + title_text: "You told us that the grant amount is %{grant}." + informative_text: "Loans, grants and subsidies are usually between £9,000 and £16,000." + + discounted_sale_value_check: + page_header: "" + check_answer_label: "Discounted sale value confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}." + informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}." + + deposit_and_mortgage_value_check: + page_header: "" + check_answer_label: "Deposit and mortgage against discount confirmation" + hint_text: "" + question_text: "Are you sure? Mortgage and deposit usually equal or are more than (value - discount)" + title_text: "You told us the mortgage amount was %{mortgage}, the cash deposit was %{deposit} and the discount was %{discount}." + informative_text: "We would expect the mortgage amount and the deposit added together to be the same as the purchase price minus the discount." diff --git a/config/locales/forms/2024/sales/sale_information.en.yml b/config/locales/forms/2024/sales/sale_information.en.yml new file mode 100644 index 000000000..d0031416e --- /dev/null +++ b/config/locales/forms/2024/sales/sale_information.en.yml @@ -0,0 +1,207 @@ +en: + forms: + 2024: + sales: + sale_information: + living_before_purchase: + joint_purchase: + page_header: "" + proplen: + check_answer_label: "Number of years living in the property before purchase" + hint_text: "You should round up to the nearest year" + question_text: "How long did they live there?" + proplen_asked: + check_answer_label: "Buyers lived in the property before purchasing" + hint_text: "" + question_text: "Did the buyers live in the property before purchasing it?" + not_joint_purchase: + page_header: "" + proplen: + check_answer_label: "Number of years living in the property before purchase" + hint_text: "You should round up to the nearest year" + question_text: "How long did they live there?" + proplen_asked: + check_answer_label: "Buyer lived in the property before purchasing" + hint_text: "" + question_text: "Did the buyer live in the property before purchasing it?" + + staircasing: + page_header: "" + check_answer_label: "Staircasing transaction" + hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" + question_text: "Is this a staircasing transaction?" + about_staircasing: + page_header: "About the staircasing transaction" + stairbought: + check_answer_label: "Percentage bought in this staircasing transaction" + hint_text: "" + question_text: "What percentage of the property has been bought in this staircasing transaction?" + stairowned: + joint_purchase: + check_answer_label: "Percentage the buyers now own in total" + hint_text: "" + question_text: "What percentage of the property do the buyers now own in total?" + not_joint_purchase: + check_answer_label: "Percentage the buyer now owns in total" + hint_text: "" + question_text: "What percentage of the property does the buyer now own in total?" + staircasesale: + check_answer_label: "Part of a back-to-back staircasing transaction" + hint_text: "" + question_text: "Is this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?" + + resale: + page_header: "" + check_answer_label: "Is this a resale?" + hint_text: "If the social landlord has previously sold the property to another buyer and is now reselling the property, select 'yes'. If this is the first time the property has been sold, select 'no'." + question_text: "Is this a resale?" + + exchange_date: + page_header: "" + check_answer_label: "Exchange of contracts date" + hint_text: "" + question_text: "What is the exchange of contracts date?" + + handover_date: + page_header: "" + check_answer_label: "Practical completion or handover date" + hint_text: "This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP)" + question_text: "What is the practical completion or handover date?" + + la_nominations: + page_header: "" + check_answer_label: "Household rehoused under a local authority nominations agreement?" + hint_text: "A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing" + question_text: "Was the household rehoused under a 'local authority nominations agreement'?" + + soctenant: + joint_purchase: + page_header: "" + check_answer_label: "Any buyers were registered providers, housing association or local authority tenants immediately before this sale?" + hint_text: "" + question_text: "Were any of the buyers private registered providers, housing association or local authority tenants immediately before this sale?" + not_joint_purchase: + page_header: "" + check_answer_label: "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?" + hint_text: "" + question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" + + frombeds: + page_header: "About the buyers’ previous property" + check_answer_label: "Number of bedrooms in previous property" + hint_text: "For bedsits enter 1" + question_text: "How many bedrooms did the property have?" + + fromprop: + page_header: "" + check_answer_label: "Previous property type" + hint_text: "" + question_text: "What was the previous property type?" + + socprevten: + page_header: "" + check_answer_label: "Previous property tenure" + hint_text: "" + question_text: "What was the previous tenure of the buyer?" + + value: + page_header: "About the price of the property" + check_answer_label: "Full purchase price" + hint_text: "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)" + question_text: "What was the full purchase price?" + + equity: + page_header: "About the price of the property" + check_answer_label: "Initial percentage equity stake" + hint_text: "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" + question_text: "What was the initial percentage equity stake purchased?" + + mortgageused: + page_header: "Mortgage Amount" + check_answer_label: "Mortgage used" + hint_text: "" + question_text: "Was a mortgage used for the purchase of this property?" + + mortgage: + page_header: "Mortgage Amount" + check_answer_label: "Mortgage amount" + hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." + question_text: "What is the mortgage amount?" + + mortgagelender: + page_header: "" + check_answer_label: "Mortgage lender" + hint_text: "" + question_text: "What is the name of the mortgage lender?" + + mortgagelenderother: + page_header: "" + check_answer_label: "Other Mortgage Lender" + hint_text: "" + question_text: "What is the other mortgage lender?" + + mortlen: + page_header: "" + check_answer_label: "Length of mortgage" + hint_text: "You should round up to the nearest year. Value should not exceed 60 years." + question_text: "What is the length of the mortgage?" + + extrabor: + page_header: "" + check_answer_label: "Any other borrowing?" + hint_text: "" + question_text: "Does this include any extra borrowing?" + + deposit: + page_header: "About the deposit" + check_answer_label: "Deposit amount" + hint_text: "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage. This excludes any grant or loan. As this is a fully staircased sale this question is optional. If you do not have the information available click save and continue" + question_text: "How much cash deposit was paid on the property?" + + cashdis: + page_header: "About the deposit" + check_answer_label: "Cash discount through SocialHomeBuy" + hint_text: "Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme" + question_text: "How much cash discount was given through Social HomeBuy?" + + mrent: + page_header: "" + check_answer_label: "Monthly rent" + hint_text: "Amount paid before any charges" + question_text: "What is the basic monthly rent?" + + leaseholdcharges: + page_header: "" + has_mscharge: + check_answer_label: "Does the property have any monthly leasehold charges?" + hint_text: "For example, service and management charges" + question_text: "Does the property have any monthly leasehold charges?" + mscharge: + check_answer_label: "Monthly leasehold charges" + hint_text: "" + question_text: "Enter the total monthly charge" + + purchase_price: + discounted_ownership: + page_header: "About the price of the property" + check_answer_label: "Purchase price" + hint_text: "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount" + question_text: "What is the full purchase price?" + outright_sale: + page_header: "About the price of the property" + check_answer_label: "Purchase price" + hint_text: "" + question_text: "What is the full purchase price?" + + discount: + page_header: "About the price of the property" + check_answer_label: "Percentage discount" + hint_text: "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)

If discount capped, enter capped %

If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." + question_text: "What was the percentage discount?" + + grant: + page_header: "About the price of the property" + check_answer_label: "Amount of any loan, grant or subsidy" + hint_text: "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy" + question_text: "What was the amount of any loan, grant, discount or subsidy given?" + \ No newline at end of file diff --git a/config/locales/forms/2024/sales/soft_validations.en.yml b/config/locales/forms/2024/sales/soft_validations.en.yml index 872db4679..b9b1ad479 100644 --- a/config/locales/forms/2024/sales/soft_validations.en.yml +++ b/config/locales/forms/2024/sales/soft_validations.en.yml @@ -57,15 +57,6 @@ en: hint_text: "" question_text: "Are you sure this is correct?" title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?" - informative_text: "" - - value_value_check: - page_header: "" - check_answer_label: "Purchase price confirmation" - hint_text: "" - question_text: "Are you sure?" - title_text: "You told us the purchase price is %{value}." - informative_text: "This is %{higher_or_lower} than we would expect." mortgage_value_check: page_header: "" @@ -75,22 +66,6 @@ en: title_text: "You told us that the mortgage amount is %{mortgage}." informative_text: "This is more than 5 times the income, which is higher than we would expect." - monthly_charges_value_check: - page_header: "" - check_answer_label: "Monthly charges confirmation" - hint_text: "" - question_text: "Are you sure this is correct?" - title_text: "You told us that the monthly charges were %{mscharge}." - informative_text: "This is higher than we would expect." - - percentage_discount_value_check: - page_header: "" - check_answer_label: "Percentage discount confirmation" - hint_text: "" - question_text: "Are you sure this is correct?" - title_text: "You told us that the percentage discount is %{discount}." - informative_text: "This is higher than we would expect." - savings_value_check: page_header: "" check_answer_label: "Savings confirmation" @@ -103,15 +78,65 @@ en: title_text: "You told us the buyer’s savings were %{savings}." informative_text: "This is higher than we would expect." - deposit_value_check: + staircase_bought_value_check: page_header: "" - check_answer_label: "Deposit confirmation" + check_answer_label: "Percentage bought confirmation" hint_text: "" - question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" + question_text: "Are you sure this is correct?" + title_text: "You told us that %{percentage}% was bought in this staircasing transaction." + informative_text: "Most staircasing transactions are less than 50%" + + stairowned_value_check: joint_purchase: + page_header: "" + check_answer_label: "Percentage owned confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us that the buyers now own %{stairowned} of the property." + informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct." + not_joint_purchase: + page_header: "" + check_answer_label: "Percentage owned confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us that the buyer now owns %{stairowned} of the property." + informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct." + + hodate_check: + page_header: "" + check_answer_label: "Practical completion or handover date check" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us practical completion or handover date is more than 3 years before sale completion date." + + value_value_check: + page_header: "" + check_answer_label: "Purchase price confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us the purchase price is %{value}." + informative_text: "This is %{higher_or_lower} than we would expect." + + shared_ownership_deposit_value_check: + page_header: "" + check_answer_label: "Shared ownership deposit confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}." + + deposit_value_check: + joint_purchase: + page_header: "" + check_answer_label: "Deposit confirmation" + hint_text: "" + question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" title_text: "You told us the buyers’ deposit was %{deposit} and their savings were %{savings}." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." not_joint_purchase: + page_header: "" + check_answer_label: "Deposit confirmation" + hint_text: "" + question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." @@ -129,6 +154,7 @@ en: hint_text: "" question_text: "You told us that someone in the household uses a wheelchair." title_text: "You told us that someone in the household uses a wheelchair." + buyer_livein_value_check: buyer1: page_header: "" @@ -144,6 +170,7 @@ en: question_text: "Are you sure this is correct?" title_text: "You told us that buyer 2 will not live in the property." informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." + student_not_child_value_check: page_header: "" check_answer_label: "Student not a child confirmation" @@ -151,6 +178,7 @@ en: question_text: "Are you sure this person is not a child?" title_text: "You told us this person is a student aged between 16 and 19." informative_text: "Are you sure this person is not a child?" + partner_under_16_value_check: page_header: "" check_answer_label: "Partner under 16 confirmation" @@ -158,6 +186,7 @@ en: question_text: "Are you sure this is correct?" title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1." informative_text: "Are you sure this is correct?" + multiple_partners_value_check: page_header: "" check_answer_label: "Multiple partners confirmation" @@ -165,3 +194,51 @@ en: question_text: "Are you sure this is correct?" title_text: "You told us there are more than 1 persons with 'Partner' relationship to buyer 1." informative_text: "Are you sure this is correct?" + + monthly_charges_value_check: + page_header: "" + check_answer_label: "Monthly charges confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the monthly charges were %{mscharge}." + informative_text: "This is higher than we would expect." + + extra_borrowing_value_check: + page_header: "" + check_answer_label: "Extra borrowing confirmation" + hint_text: "" + question_text: "Are you sure there is no extra borrowing?" + title_text: "You told us that the mortgage and deposit total is %{mortgage_and_deposit_total}." + informative_text: "This is higher than the purchase price minus the discount." + + percentage_discount_value_check: + page_header: "" + check_answer_label: "Percentage discount confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the percentage discount is %{discount}." + informative_text: "This is higher than we would expect." + + grant_value_check: + page_header: "" + check_answer_label: "Grant value confirmation" + hint_text: "" + question_text: "Are you sure? Grants are usually £9,000 - £16,000" + title_text: "You told us that the grant amount is %{grant}." + informative_text: "Loans, grants and subsidies are usually between £9,000 and £16,000." + + discounted_sale_value_check: + page_header: "" + check_answer_label: "Discounted sale value confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}." + informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}." + + deposit_and_mortgage_value_check: + page_header: "" + check_answer_label: "Deposit and mortgage against discount confirmation" + hint_text: "" + question_text: "Are you sure? Mortgage and deposit usually equal or are more than (value - discount)" + title_text: "You told us the mortgage amount was %{mortgage}, the cash deposit was %{deposit} and the discount was %{discount}." + informative_text: "We would expect the mortgage amount and the deposit added together to be the same as the purchase price minus the discount." diff --git a/spec/models/form/lettings/subsections/tenancy_information_spec.rb b/spec/models/form/lettings/subsections/tenancy_information_spec.rb index 96770ea78..0c69f89ab 100644 --- a/spec/models/form/lettings/subsections/tenancy_information_spec.rb +++ b/spec/models/form/lettings/subsections/tenancy_information_spec.rb @@ -12,7 +12,7 @@ RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do end describe "pages" do - let(:section) { instance_double(Form::Sales::Sections::Household, form:) } + let(:section) { instance_double(Form::Lettings::Sections::TenancyAndProperty, form:) } let(:form) { instance_double(Form, start_date:) } before do diff --git a/spec/models/form/sales/pages/discounted_sale_value_check_spec.rb b/spec/models/form/sales/pages/discounted_sale_value_check_spec.rb index 38a5f69ae..3b51ec744 100644 --- a/spec/models/form/sales/pages/discounted_sale_value_check_spec.rb +++ b/spec/models/form/sales/pages/discounted_sale_value_check_spec.rb @@ -6,7 +6,8 @@ RSpec.describe Form::Sales::Pages::DiscountedSaleValueCheck, type: :model do let(:page_id) { "discounted_sale_value_check" } let(:page_definition) { nil } let(:index) { 1 } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -22,14 +23,14 @@ RSpec.describe Form::Sales::Pages::DiscountedSaleValueCheck, type: :model do it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.discounted_sale_value.title_text", + "translation" => "forms.2024.sales.soft_validations.discounted_sale_value_check.title_text", "arguments" => [{ "arguments_for_key" => "value_with_discount", "i18n_template" => "value_with_discount", "key" => "field_formatted_as_currency" }], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.discounted_sale_value.informative_text", + "translation" => "forms.2024.sales.soft_validations.discounted_sale_value_check.informative_text", "arguments" => [{ "arguments_for_key" => "mortgage_deposit_and_grant_total", "i18n_template" => "mortgage_deposit_and_grant_total", "key" => "field_formatted_as_currency" }], }) end diff --git a/spec/models/form/sales/pages/handover_date_check_spec.rb b/spec/models/form/sales/pages/handover_date_check_spec.rb index f245675d5..ae465da16 100644 --- a/spec/models/form/sales/pages/handover_date_check_spec.rb +++ b/spec/models/form/sales/pages/handover_date_check_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::HandoverDateCheck, type: :model do let(:page_id) { "" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -21,7 +22,7 @@ RSpec.describe Form::Sales::Pages::HandoverDateCheck, type: :model do it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.hodate.must_be_less_than_3_years_from_saledate", + "translation" => "forms.2024.sales.soft_validations.hodate_check.title_text", "arguments" => [], }) end diff --git a/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb b/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb index 3a1c22f24..bca971fe5 100644 --- a/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb +++ b/spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode let(:page_id) { "shared_ownership_deposit_value_check" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -29,7 +30,7 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.shared_ownership_deposit.title_text", + "translation" => "forms.2024.sales.soft_validations.shared_ownership_deposit_value_check.title_text", "arguments" => [ { "i18n_template" => "mortgage_deposit_and_discount_error_fields", "key" => "mortgage_deposit_and_discount_error_fields" }, { "arguments_for_key" => "mortgage_deposit_and_discount_total", "i18n_template" => "mortgage_deposit_and_discount_total", "key" => "field_formatted_as_currency" }, @@ -37,10 +38,6 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode }) end - it "has the correct informative_text" do - expect(page.informative_text).to eq({}) - end - it "has the correct interruption_screen_question_ids" do expect(page.interruption_screen_question_ids).to eq(%w[mortgage mortgageused cashdis type deposit value equity]) end diff --git a/spec/models/form/sales/pages/staircase_owned_value_check_spec.rb b/spec/models/form/sales/pages/staircase_owned_value_check_spec.rb index 95e59ea4e..5fa65fd8d 100644 --- a/spec/models/form/sales/pages/staircase_owned_value_check_spec.rb +++ b/spec/models/form/sales/pages/staircase_owned_value_check_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do let(:page_id) { "an_id" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } let(:joint_purchase) { false } it "has correct subsection" do @@ -33,7 +34,7 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.staircase_owned.hint_text", + "translation" => "forms.2024.sales.soft_validations.stairowned_value_check.not_joint_purchase.informative_text", "arguments" => [], }) end @@ -45,7 +46,7 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do context "when not a joint purchase" do it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.staircase_owned.title_text.one", + "translation" => "forms.2024.sales.soft_validations.stairowned_value_check.not_joint_purchase.title_text", "arguments" => [ { "key" => "stairowned", @@ -62,7 +63,7 @@ RSpec.describe Form::Sales::Pages::StaircaseOwnedValueCheck, type: :model do it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.staircase_owned.title_text.two", + "translation" => "forms.2024.sales.soft_validations.stairowned_value_check.joint_purchase.title_text", "arguments" => [ { "key" => "stairowned", diff --git a/spec/models/form/sales/questions/deposit_value_check_spec.rb b/spec/models/form/sales/questions/deposit_value_check_spec.rb index 2e861110a..077c2e6a6 100644 --- a/spec/models/form/sales/questions/deposit_value_check_spec.rb +++ b/spec/models/form/sales/questions/deposit_value_check_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::DepositValueCheck, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page) } + subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: true) } let(:question_id) { nil } let(:question_definition) { nil } diff --git a/spec/models/form/sales/questions/living_before_purchase_years_spec.rb b/spec/models/form/sales/questions/living_before_purchase_years_spec.rb index c9893dece..ddf5abd8f 100644 --- a/spec/models/form/sales/questions/living_before_purchase_years_spec.rb +++ b/spec/models/form/sales/questions/living_before_purchase_years_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::LivingBeforePurchaseYears, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page, ownershipsch: 1) } + subject(:question) { described_class.new(question_id, question_definition, page, ownershipsch: 1, joint_purchase: true) } let(:question_id) { nil } let(:question_definition) { nil } diff --git a/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb b/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb index 4298e40b8..cbff9cec1 100644 --- a/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb +++ b/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::StaircaseOwnedValueCheck, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page) } + subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: true) } let(:question_id) { nil } let(:question_definition) { nil } From f3d709f6c84660f8396752c69da66ad7e9e9ed4d Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Fri, 1 Nov 2024 09:49:44 +0000 Subject: [PATCH 02/27] Add paper_trail to bulk upload objects (#2745) --- app/models/bulk_upload.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index 93f661225..a0ed265c9 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -32,6 +32,8 @@ class BulkUpload < ApplicationRecord scope :filter_by_user, ->(user_id, _user = nil) { user_id.present? ? where(user_id:) : all } scope :filter_by_uploading_organisation, ->(organisation_id, _user = nil) { where(organisation_id:) } + has_paper_trail + def completed? incomplete_logs = logs.where.not(status: "completed") !incomplete_logs.exists? From fa83f3abc2c8ed49d4022d8ac565feaf2274b892 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:18:24 +0000 Subject: [PATCH 03/27] CLDC-3685: Copy changes lettings income and benefits (#2732) --- .../form/lettings/pages/care_home_weekly.rb | 1 + .../form/lettings/pages/income_amount.rb | 2 +- .../form/lettings/pages/income_known.rb | 1 - .../form/lettings/pages/rent_4_weekly.rb | 2 +- .../form/lettings/pages/rent_bi_weekly.rb | 2 +- .../form/lettings/pages/rent_monthly.rb | 2 +- app/models/form/lettings/pages/rent_weekly.rb | 2 +- .../form/lettings/questions/benefits.rb | 3 - .../form/lettings/questions/brent_4_weekly.rb | 4 +- .../lettings/questions/brent_bi_weekly.rb | 4 +- .../form/lettings/questions/brent_monthly.rb | 4 +- .../form/lettings/questions/brent_weekly.rb | 4 +- .../lettings/questions/chcharge_4_weekly.rb | 4 +- .../lettings/questions/chcharge_bi_weekly.rb | 4 +- .../lettings/questions/chcharge_monthly.rb | 4 +- .../lettings/questions/chcharge_weekly.rb | 4 +- .../form/lettings/questions/earnings.rb | 4 +- app/models/form/lettings/questions/hb.rb | 3 - .../lettings/questions/hbrentshortfall.rb | 3 - .../lettings/questions/household_charge.rb | 3 - app/models/form/lettings/questions/incfreq.rb | 4 +- .../form/lettings/questions/is_carehome.rb | 4 +- .../lettings/questions/net_income_known.rb | 3 - app/models/form/lettings/questions/period.rb | 3 - .../lettings/questions/pscharge_4_weekly.rb | 4 +- .../lettings/questions/pscharge_bi_weekly.rb | 4 +- .../lettings/questions/pscharge_monthly.rb | 4 +- .../lettings/questions/pscharge_weekly.rb | 4 +- .../lettings/questions/scharge_4_weekly.rb | 4 +- .../lettings/questions/scharge_bi_weekly.rb | 4 +- .../lettings/questions/scharge_monthly.rb | 4 +- .../form/lettings/questions/scharge_weekly.rb | 4 +- .../lettings/questions/supcharg_4_weekly.rb | 4 +- .../lettings/questions/supcharg_bi_weekly.rb | 4 +- .../lettings/questions/supcharg_monthly.rb | 4 +- .../lettings/questions/supcharg_weekly.rb | 4 +- .../lettings/questions/tcharge_4_weekly.rb | 4 +- .../lettings/questions/tcharge_bi_weekly.rb | 4 +- .../lettings/questions/tcharge_monthly.rb | 4 +- .../form/lettings/questions/tcharge_weekly.rb | 4 +- .../form/lettings/questions/tshortfall.rb | 3 +- .../lettings/questions/tshortfall_known.rb | 4 +- .../2023/lettings/income_and_benefits.en.yml | 108 ++++++++++++++++++ .../2024/lettings/income_and_benefits.en.yml | 108 ++++++++++++++++++ 44 files changed, 251 insertions(+), 110 deletions(-) create mode 100644 config/locales/forms/2023/lettings/income_and_benefits.en.yml create mode 100644 config/locales/forms/2024/lettings/income_and_benefits.en.yml diff --git a/app/models/form/lettings/pages/care_home_weekly.rb b/app/models/form/lettings/pages/care_home_weekly.rb index 56165ce62..ef0ca01c3 100644 --- a/app/models/form/lettings/pages/care_home_weekly.rb +++ b/app/models/form/lettings/pages/care_home_weekly.rb @@ -2,6 +2,7 @@ class Form::Lettings::Pages::CareHomeWeekly < ::Form::Page def initialize(id, hsh, subsection) super @id = "care_home_weekly" + @copy_key = "lettings.income_and_benefits.care_home" @depends_on = [ { "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => 0 }, { "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => nil }, diff --git a/app/models/form/lettings/pages/income_amount.rb b/app/models/form/lettings/pages/income_amount.rb index 589ae463a..71151e695 100644 --- a/app/models/form/lettings/pages/income_amount.rb +++ b/app/models/form/lettings/pages/income_amount.rb @@ -2,7 +2,7 @@ class Form::Lettings::Pages::IncomeAmount < ::Form::Page def initialize(id, hsh, subsection) super @id = "income_amount" - @header = "Total household income" + @copy_key = "lettings.income_and_benefits.income_amount" @depends_on = [{ "net_income_known" => 0 }] end diff --git a/app/models/form/lettings/pages/income_known.rb b/app/models/form/lettings/pages/income_known.rb index c031b1521..ba026d93f 100644 --- a/app/models/form/lettings/pages/income_known.rb +++ b/app/models/form/lettings/pages/income_known.rb @@ -2,7 +2,6 @@ class Form::Lettings::Pages::IncomeKnown < ::Form::Page def initialize(id, hsh, subsection) super @id = "income_known" - @header = "Household’s combined income after tax" end def questions diff --git a/app/models/form/lettings/pages/rent_4_weekly.rb b/app/models/form/lettings/pages/rent_4_weekly.rb index e71cd7ffa..aa6441f6e 100644 --- a/app/models/form/lettings/pages/rent_4_weekly.rb +++ b/app/models/form/lettings/pages/rent_4_weekly.rb @@ -2,7 +2,7 @@ class Form::Lettings::Pages::Rent4Weekly < ::Form::Page def initialize(id, hsh, subsection) super @id = "rent_4_weekly" - @header = "Household rent and charges" + @copy_key = "lettings.income_and_benefits.rent_and_charges" @depends_on = [ { "household_charge" => 0, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false }, { "household_charge" => nil, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false }, diff --git a/app/models/form/lettings/pages/rent_bi_weekly.rb b/app/models/form/lettings/pages/rent_bi_weekly.rb index 0b1b9c884..7eab8daf4 100644 --- a/app/models/form/lettings/pages/rent_bi_weekly.rb +++ b/app/models/form/lettings/pages/rent_bi_weekly.rb @@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentBiWeekly < ::Form::Page def initialize(id, hsh, subsection) super @id = "rent_bi_weekly" - @header = "Household rent and charges" + @copy_key = "lettings.income_and_benefits.rent_and_charges" @depends_on = [ { "household_charge" => nil, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false }, { "household_charge" => 0, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false }, diff --git a/app/models/form/lettings/pages/rent_monthly.rb b/app/models/form/lettings/pages/rent_monthly.rb index d6af7a08c..9a3cd6a7e 100644 --- a/app/models/form/lettings/pages/rent_monthly.rb +++ b/app/models/form/lettings/pages/rent_monthly.rb @@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentMonthly < ::Form::Page def initialize(id, hsh, subsection) super @id = "rent_monthly" - @header = "Household rent and charges" + @copy_key = "lettings.income_and_benefits.rent_and_charges" @depends_on = [ { "household_charge" => nil, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false }, { "household_charge" => 0, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false }, diff --git a/app/models/form/lettings/pages/rent_weekly.rb b/app/models/form/lettings/pages/rent_weekly.rb index 4f1709820..86106cfe3 100644 --- a/app/models/form/lettings/pages/rent_weekly.rb +++ b/app/models/form/lettings/pages/rent_weekly.rb @@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentWeekly < ::Form::Page def initialize(id, hsh, subsection) super @id = "rent_weekly" - @header = "Household rent and charges" + @copy_key = "lettings.income_and_benefits.rent_and_charges" @depends_on = [ { "rent_and_charges_paid_weekly?" => true, "household_charge" => 0, "is_carehome?" => false }, { "rent_and_charges_paid_weekly?" => true, "household_charge" => nil, "is_carehome?" => false }, diff --git a/app/models/form/lettings/questions/benefits.rb b/app/models/form/lettings/questions/benefits.rb index bc17396fb..f5f2a3ee1 100644 --- a/app/models/form/lettings/questions/benefits.rb +++ b/app/models/form/lettings/questions/benefits.rb @@ -2,11 +2,8 @@ class Form::Lettings::Questions::Benefits < ::Form::Question def initialize(id, hsh, page) super @id = "benefits" - @check_answer_label = "Household income from Universal Credit, state pension or benefits" - @header = "How much of the household’s income is from Universal Credit, state pensions or benefits?" @type = "radio" @check_answers_card_number = 0 - @hint_text = "This excludes child and housing benefit, council tax support and tax credits." @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/brent_4_weekly.rb b/app/models/form/lettings/questions/brent_4_weekly.rb index 436b628ad..2dc18ba56 100644 --- a/app/models/form/lettings/questions/brent_4_weekly.rb +++ b/app/models/form/lettings/questions/brent_4_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::Brent4Weekly < ::Form::Question def initialize(id, hsh, page) super @id = "brent" - @check_answer_label = "Basic rent" - @header = "What is the basic rent?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.brent" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/brent_bi_weekly.rb b/app/models/form/lettings/questions/brent_bi_weekly.rb index 8dc27b610..d8bcfa136 100644 --- a/app/models/form/lettings/questions/brent_bi_weekly.rb +++ b/app/models/form/lettings/questions/brent_bi_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentBiWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "brent" - @check_answer_label = "Basic rent" - @header = "What is the basic rent?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.brent" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/brent_monthly.rb b/app/models/form/lettings/questions/brent_monthly.rb index 7b567736b..a96239d7a 100644 --- a/app/models/form/lettings/questions/brent_monthly.rb +++ b/app/models/form/lettings/questions/brent_monthly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentMonthly < ::Form::Question def initialize(id, hsh, page) super @id = "brent" - @check_answer_label = "Basic rent" - @header = "What is the basic rent?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.brent" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/brent_weekly.rb b/app/models/form/lettings/questions/brent_weekly.rb index e604e5f34..155addfec 100644 --- a/app/models/form/lettings/questions/brent_weekly.rb +++ b/app/models/form/lettings/questions/brent_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "brent" - @check_answer_label = "Basic rent" - @header = "What is the basic rent?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.brent" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/chcharge_4_weekly.rb b/app/models/form/lettings/questions/chcharge_4_weekly.rb index b42bbe052..1cf3adae4 100644 --- a/app/models/form/lettings/questions/chcharge_4_weekly.rb +++ b/app/models/form/lettings/questions/chcharge_4_weekly.rb @@ -2,12 +2,10 @@ class Form::Lettings::Questions::Chcharge4Weekly < ::Form::Question def initialize(id, hsh, page) super @id = "chcharge" - @check_answer_label = "Care home charges" - @header = "How much does the household pay every 4 weeks?" + @copy_key = "lettings.income_and_benefits.care_home.chcharge_4_weekly" @type = "numeric" @width = 5 @check_answers_card_number = 0 - @hint_text = "" @step = 0.01 @prefix = "£" @suffix = " every 4 weeks" diff --git a/app/models/form/lettings/questions/chcharge_bi_weekly.rb b/app/models/form/lettings/questions/chcharge_bi_weekly.rb index 72de6d32b..c2abc4bdd 100644 --- a/app/models/form/lettings/questions/chcharge_bi_weekly.rb +++ b/app/models/form/lettings/questions/chcharge_bi_weekly.rb @@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeBiWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "chcharge" - @check_answer_label = "Care home charges" - @header = "How much does the household pay every 2 weeks?" + @copy_key = "lettings.income_and_benefits.care_home.chcharge_bi_weekly" @type = "numeric" @width = 5 @check_answers_card_number = 0 - @hint_text = "" @step = 0.01 @prefix = "£" @suffix = " every 2 weeks" diff --git a/app/models/form/lettings/questions/chcharge_monthly.rb b/app/models/form/lettings/questions/chcharge_monthly.rb index c640085d2..d76a4ae1f 100644 --- a/app/models/form/lettings/questions/chcharge_monthly.rb +++ b/app/models/form/lettings/questions/chcharge_monthly.rb @@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeMonthly < ::Form::Question def initialize(id, hsh, page) super @id = "chcharge" - @check_answer_label = "Care home charges" - @header = "How much does the household pay every month?" + @copy_key = "lettings.income_and_benefits.care_home.chcharge_monthly" @type = "numeric" @width = 5 @check_answers_card_number = 0 - @hint_text = "" @step = 0.01 @prefix = "£" @suffix = " every month" diff --git a/app/models/form/lettings/questions/chcharge_weekly.rb b/app/models/form/lettings/questions/chcharge_weekly.rb index 484da8b5b..ab7f64622 100644 --- a/app/models/form/lettings/questions/chcharge_weekly.rb +++ b/app/models/form/lettings/questions/chcharge_weekly.rb @@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "chcharge" - @check_answer_label = "Care home charges" - @header = "How much does the household pay every week?" + @copy_key = "lettings.income_and_benefits.care_home.chcharge_weekly" @type = "numeric" @width = 5 @check_answers_card_number = 0 - @hint_text = "" @step = 0.01 @prefix = "£" @suffix = " every week" diff --git a/app/models/form/lettings/questions/earnings.rb b/app/models/form/lettings/questions/earnings.rb index 2ebb3e30b..9dc070e6a 100644 --- a/app/models/form/lettings/questions/earnings.rb +++ b/app/models/form/lettings/questions/earnings.rb @@ -2,14 +2,12 @@ class Form::Lettings::Questions::Earnings < ::Form::Question def initialize(id, hsh, page) super @id = "earnings" - @check_answer_label = "Total household income" - @header = "How much income does the household have in total?" + @copy_key = "lettings.income_and_benefits.income_amount.earnings" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 @top_guidance_partial = "what_counts_as_income" - @hint_text = "" @step = 0.01 @prefix = "£" @suffix = [ diff --git a/app/models/form/lettings/questions/hb.rb b/app/models/form/lettings/questions/hb.rb index a3feba77a..4f4703993 100644 --- a/app/models/form/lettings/questions/hb.rb +++ b/app/models/form/lettings/questions/hb.rb @@ -2,11 +2,8 @@ class Form::Lettings::Questions::Hb < ::Form::Question def initialize(id, hsh, page) super @id = "hb" - @check_answer_label = "Housing-related benefits received" - @header = "Is the household likely to be receiving any of these housing-related benefits?" @type = "radio" @check_answers_card_number = 0 - @hint_text = form.start_year_after_2024? ? "This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive." : "" @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/hbrentshortfall.rb b/app/models/form/lettings/questions/hbrentshortfall.rb index ee9546e73..a34df70e0 100644 --- a/app/models/form/lettings/questions/hbrentshortfall.rb +++ b/app/models/form/lettings/questions/hbrentshortfall.rb @@ -2,11 +2,8 @@ class Form::Lettings::Questions::Hbrentshortfall < ::Form::Question def initialize(id, hsh, page) super @id = "hbrentshortfall" - @check_answer_label = "Any outstanding amount for basic rent and charges" - @header = "After the household has received any housing-related benefits, will they still need to pay for rent and charges?" @type = "radio" @check_answers_card_number = 0 - @hint_text = "Also known as the ‘outstanding amount’." @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/household_charge.rb b/app/models/form/lettings/questions/household_charge.rb index 7f89aa548..60fee977d 100644 --- a/app/models/form/lettings/questions/household_charge.rb +++ b/app/models/form/lettings/questions/household_charge.rb @@ -2,11 +2,8 @@ class Form::Lettings::Questions::HouseholdCharge < ::Form::Question def initialize(id, hsh, page) super @id = "household_charge" - @check_answer_label = "Does the household pay rent or charges?" - @header = "Does the household pay rent or other charges for the accommodation?" @type = "radio" @check_answers_card_number = 0 - @hint_text = "If rent is charged on the property then answer Yes to this question, even if the tenants do not pay it themselves." @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/incfreq.rb b/app/models/form/lettings/questions/incfreq.rb index 3067c5c98..d4384218e 100644 --- a/app/models/form/lettings/questions/incfreq.rb +++ b/app/models/form/lettings/questions/incfreq.rb @@ -2,11 +2,9 @@ class Form::Lettings::Questions::Incfreq < ::Form::Question def initialize(id, hsh, page) super @id = "incfreq" - @check_answer_label = "How often does the household receive this amount?" - @header = "How often does the household receive this amount?" + @copy_key = "lettings.income_and_benefits.income_amount.incfreq" @type = "radio" @check_answers_card_number = 0 - @hint_text = "" @answer_options = ANSWER_OPTIONS @hidden_in_check_answers = true @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] diff --git a/app/models/form/lettings/questions/is_carehome.rb b/app/models/form/lettings/questions/is_carehome.rb index 41996b4f0..efb29a817 100644 --- a/app/models/form/lettings/questions/is_carehome.rb +++ b/app/models/form/lettings/questions/is_carehome.rb @@ -2,11 +2,9 @@ class Form::Lettings::Questions::IsCarehome < ::Form::Question def initialize(id, hsh, page) super @id = "is_carehome" - @check_answer_label = "Care home accommodation" - @header = "Is this accommodation a care home?" + @copy_key = "lettings.income_and_benefits.care_home.is_carehome" @type = "radio" @check_answers_card_number = 0 - @hint_text = "" @conditional_for = { "chcharge" => [1] } @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/net_income_known.rb b/app/models/form/lettings/questions/net_income_known.rb index 5858d4d26..01c3bcaa3 100644 --- a/app/models/form/lettings/questions/net_income_known.rb +++ b/app/models/form/lettings/questions/net_income_known.rb @@ -2,12 +2,9 @@ class Form::Lettings::Questions::NetIncomeKnown < ::Form::Question def initialize(id, hsh, page) super @id = "net_income_known" - @check_answer_label = "Do you know the household’s combined total income after tax?" - @header = "Do you know the household’s combined income after tax?" @type = "radio" @check_answers_card_number = 0 @top_guidance_partial = "what_counts_as_income" - @hint_text = "" @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/period.rb b/app/models/form/lettings/questions/period.rb index aefe8be84..6f98bd2a8 100644 --- a/app/models/form/lettings/questions/period.rb +++ b/app/models/form/lettings/questions/period.rb @@ -2,11 +2,8 @@ class Form::Lettings::Questions::Period < ::Form::Question def initialize(id, hsh, page) super @id = "period" - @check_answer_label = "Frequency of household rent and charges" - @header = "How often does the household pay rent and other charges?" @type = "radio" @check_answers_card_number = 0 - @hint_text = "Select how often the household is charged. This may be different to how often they pay." @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/pscharge_4_weekly.rb b/app/models/form/lettings/questions/pscharge_4_weekly.rb index 0340e55b8..56d2e60b8 100644 --- a/app/models/form/lettings/questions/pscharge_4_weekly.rb +++ b/app/models/form/lettings/questions/pscharge_4_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::Pscharge4Weekly < ::Form::Question def initialize(id, hsh, page) super @id = "pscharge" - @check_answer_label = "Personal service charge" - @header = "What is the personal service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.pscharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for heating or hot water. This doesn’t include housing benefit or Universal Credit." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/pscharge_bi_weekly.rb b/app/models/form/lettings/questions/pscharge_bi_weekly.rb index db4e040f0..6022f6019 100644 --- a/app/models/form/lettings/questions/pscharge_bi_weekly.rb +++ b/app/models/form/lettings/questions/pscharge_bi_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::PschargeBiWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "pscharge" - @check_answer_label = "Personal service charge" - @header = "What is the personal service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.pscharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for heating or hot water. This doesn’t include housing benefit or Universal Credit." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/pscharge_monthly.rb b/app/models/form/lettings/questions/pscharge_monthly.rb index e96cd32d4..225db53d3 100644 --- a/app/models/form/lettings/questions/pscharge_monthly.rb +++ b/app/models/form/lettings/questions/pscharge_monthly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::PschargeMonthly < ::Form::Question def initialize(id, hsh, page) super @id = "pscharge" - @check_answer_label = "Personal service charge" - @header = "What is the personal service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.pscharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for heating or hot water. This doesn’t include housing benefit or Universal Credit." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/pscharge_weekly.rb b/app/models/form/lettings/questions/pscharge_weekly.rb index 6b5fa9889..2ff06301c 100644 --- a/app/models/form/lettings/questions/pscharge_weekly.rb +++ b/app/models/form/lettings/questions/pscharge_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::PschargeWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "pscharge" - @check_answer_label = "Personal service charge" - @header = "What is the personal service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.pscharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for heating or hot water. This doesn’t include housing benefit or Universal Credit." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/scharge_4_weekly.rb b/app/models/form/lettings/questions/scharge_4_weekly.rb index a2f81c6ef..e91dadab3 100644 --- a/app/models/form/lettings/questions/scharge_4_weekly.rb +++ b/app/models/form/lettings/questions/scharge_4_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::Scharge4Weekly < ::Form::Question def initialize(id, hsh, page) super @id = "scharge" - @check_answer_label = "Service charge" - @header = "What is the service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.scharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for cleaning. Households may receive housing benefit or Universal Credit towards the service charge." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/scharge_bi_weekly.rb b/app/models/form/lettings/questions/scharge_bi_weekly.rb index a19acbab5..59138835d 100644 --- a/app/models/form/lettings/questions/scharge_bi_weekly.rb +++ b/app/models/form/lettings/questions/scharge_bi_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SchargeBiWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "scharge" - @check_answer_label = "Service charge" - @header = "What is the service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.scharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for cleaning. Households may receive housing benefit or Universal Credit towards the service charge." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/scharge_monthly.rb b/app/models/form/lettings/questions/scharge_monthly.rb index eb399b0de..33404a8ce 100644 --- a/app/models/form/lettings/questions/scharge_monthly.rb +++ b/app/models/form/lettings/questions/scharge_monthly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SchargeMonthly < ::Form::Question def initialize(id, hsh, page) super @id = "scharge" - @check_answer_label = "Service charge" - @header = "What is the service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.scharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for cleaning. Households may receive housing benefit or Universal Credit towards the service charge." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/scharge_weekly.rb b/app/models/form/lettings/questions/scharge_weekly.rb index faf854b82..d8e16986e 100644 --- a/app/models/form/lettings/questions/scharge_weekly.rb +++ b/app/models/form/lettings/questions/scharge_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SchargeWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "scharge" - @check_answer_label = "Service charge" - @header = "What is the service charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.scharge" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "For example, for cleaning. Households may receive housing benefit or Universal Credit towards the service charge." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/supcharg_4_weekly.rb b/app/models/form/lettings/questions/supcharg_4_weekly.rb index 292578d56..cd3b7beed 100644 --- a/app/models/form/lettings/questions/supcharg_4_weekly.rb +++ b/app/models/form/lettings/questions/supcharg_4_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::Supcharg4Weekly < ::Form::Question def initialize(id, hsh, page) super @id = "supcharg" - @check_answer_label = "Support charge" - @header = "What is the support charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.supcharg" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "Any charges made to fund support services included in tenancy agreement." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/supcharg_bi_weekly.rb b/app/models/form/lettings/questions/supcharg_bi_weekly.rb index 4f6daf141..dba861ebe 100644 --- a/app/models/form/lettings/questions/supcharg_bi_weekly.rb +++ b/app/models/form/lettings/questions/supcharg_bi_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SupchargBiWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "supcharg" - @check_answer_label = "Support charge" - @header = "What is the support charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.supcharg" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "Any charges made to fund support services included in tenancy agreement." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/supcharg_monthly.rb b/app/models/form/lettings/questions/supcharg_monthly.rb index 9dd1c669b..3b5b3e41c 100644 --- a/app/models/form/lettings/questions/supcharg_monthly.rb +++ b/app/models/form/lettings/questions/supcharg_monthly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SupchargMonthly < ::Form::Question def initialize(id, hsh, page) super @id = "supcharg" - @check_answer_label = "Support charge" - @header = "What is the support charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.supcharg" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "Any charges made to fund support services included in tenancy agreement." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/supcharg_weekly.rb b/app/models/form/lettings/questions/supcharg_weekly.rb index 54a9743b6..f48a8ccfe 100644 --- a/app/models/form/lettings/questions/supcharg_weekly.rb +++ b/app/models/form/lettings/questions/supcharg_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SupchargWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "supcharg" - @check_answer_label = "Support charge" - @header = "What is the support charge?" + @copy_key = "lettings.income_and_benefits.rent_and_charges.supcharg" @type = "numeric" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "Any charges made to fund support services included in tenancy agreement." @step = 0.01 @fields_to_add = %w[brent scharge pscharge supcharg] @result_field = "tcharge" diff --git a/app/models/form/lettings/questions/tcharge_4_weekly.rb b/app/models/form/lettings/questions/tcharge_4_weekly.rb index 3a353efe8..6475adab0 100644 --- a/app/models/form/lettings/questions/tcharge_4_weekly.rb +++ b/app/models/form/lettings/questions/tcharge_4_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::Tcharge4Weekly < ::Form::Question def initialize(id, hsh, page) super @id = "tcharge" - @check_answer_label = "Household rent and charges" - @header = "Total charge" + @copy_key = "lettings.income_and_benefits.rent_and_charges.tcharge" @type = "numeric_output" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the total for rent and all charges." @step = 0.01 @readonly = true @prefix = "£" diff --git a/app/models/form/lettings/questions/tcharge_bi_weekly.rb b/app/models/form/lettings/questions/tcharge_bi_weekly.rb index 42fd9398b..446886d9d 100644 --- a/app/models/form/lettings/questions/tcharge_bi_weekly.rb +++ b/app/models/form/lettings/questions/tcharge_bi_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::TchargeBiWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "tcharge" - @check_answer_label = "Household rent and charges" - @header = "Total charge" + @copy_key = "lettings.income_and_benefits.rent_and_charges.tcharge" @type = "numeric_output" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the total for rent and all charges." @step = 0.01 @readonly = true @prefix = "£" diff --git a/app/models/form/lettings/questions/tcharge_monthly.rb b/app/models/form/lettings/questions/tcharge_monthly.rb index 3fcabdace..2c52f4c92 100644 --- a/app/models/form/lettings/questions/tcharge_monthly.rb +++ b/app/models/form/lettings/questions/tcharge_monthly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::TchargeMonthly < ::Form::Question def initialize(id, hsh, page) super @id = "tcharge" - @check_answer_label = "Household rent and charges" - @header = "Total charge" + @copy_key = "lettings.income_and_benefits.rent_and_charges.tcharge" @type = "numeric_output" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the total for rent and all charges." @step = 0.01 @readonly = true @prefix = "£" diff --git a/app/models/form/lettings/questions/tcharge_weekly.rb b/app/models/form/lettings/questions/tcharge_weekly.rb index d1ac7cb34..0c0ee5d8e 100644 --- a/app/models/form/lettings/questions/tcharge_weekly.rb +++ b/app/models/form/lettings/questions/tcharge_weekly.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::TchargeWeekly < ::Form::Question def initialize(id, hsh, page) super @id = "tcharge" - @check_answer_label = "Household rent and charges" - @header = "Total charge" + @copy_key = "lettings.income_and_benefits.rent_and_charges.tcharge" @type = "numeric_output" @width = 5 @check_answers_card_number = 0 @min = 0 - @hint_text = "This is the total for rent and all charges." @step = 0.01 @readonly = true @prefix = "£" diff --git a/app/models/form/lettings/questions/tshortfall.rb b/app/models/form/lettings/questions/tshortfall.rb index 75583008c..3219c7689 100644 --- a/app/models/form/lettings/questions/tshortfall.rb +++ b/app/models/form/lettings/questions/tshortfall.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::Tshortfall < ::Form::Question def initialize(id, hsh, page) super @id = "tshortfall" - @check_answer_label = "Estimated outstanding amount" - @header = "Estimated outstanding amount" + @copy_key = "lettings.income_and_benefits.outstanding_amount.tshortfall" @type = "numeric" @width = 5 @check_answers_card_number = 0 diff --git a/app/models/form/lettings/questions/tshortfall_known.rb b/app/models/form/lettings/questions/tshortfall_known.rb index 600736077..7a5da7127 100644 --- a/app/models/form/lettings/questions/tshortfall_known.rb +++ b/app/models/form/lettings/questions/tshortfall_known.rb @@ -2,11 +2,9 @@ class Form::Lettings::Questions::TshortfallKnown < ::Form::Question def initialize(id, hsh, page) super @id = "tshortfall_known" - @check_answer_label = "Do you know the outstanding amount?" - @header = "Can you estimate the outstanding amount?" + @copy_key = "lettings.income_and_benefits.outstanding_amount.tshortfall_known" @type = "radio" @check_answers_card_number = 0 - @hint_text = "You only need to give an approximate figure." @answer_options = ANSWER_OPTIONS @conditional_for = { "tshortfall" => [0] } @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] diff --git a/config/locales/forms/2023/lettings/income_and_benefits.en.yml b/config/locales/forms/2023/lettings/income_and_benefits.en.yml new file mode 100644 index 000000000..bc19c7954 --- /dev/null +++ b/config/locales/forms/2023/lettings/income_and_benefits.en.yml @@ -0,0 +1,108 @@ +en: + forms: + 2023: + lettings: + income_and_benefits: + net_income_known: + page_header: "Household’s combined income after tax" + check_answer_label: "Do you know the household’s combined total income after tax?" + hint_text: "" + question_text: "Do you know the household’s combined income after tax?" + + income_amount: + page_header: "Total household income" + incfreq: + check_answer_label: "How often does the household receive this amount?" + hint_text: "" + question_text: "How often does the household receive this amount?" + earnings: + check_answer_label: "Total household income" + hint_text: "" + question_text: "How much income does the household have in total?" + + hb: + page_header: "" + check_answer_label: "Housing-related benefits received" + hint_text: "" + question_text: "Is the household likely to be receiving any of these housing-related benefits?" + + benefits: + page_header: "" + check_answer_label: "Household income from Universal Credit, state pension or benefit" + hint_text: "This excludes child and housing benefit, council tax support and tax credits." + question_text: "How much of the household’s income is from Universal Credit, state pensions or benefits?" + + household_charge: + page_header: "" + check_answer_label: "Does the household pay rent or charges" + hint_text: "If rent is charged on the property then answer Yes to this question, even if the tenants do not pay it themselves." + question_text: "Does the household pay rent or other charges for the accommodation?" + + period: + page_header: "" + check_answer_label: "Frequency of household rent and charges" + hint_text: "Select how often the household is charged. This may be different to how often they pay." + question_text: "How often does the household pay rent and other charges?" + + care_home: + page_header: "" + is_carehome: + check_answer_label: "Care home accommodation" + hint_text: "" + question_text: "Is this accommodation a care home?" + chcharge_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every week?" + chcharge_bi_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every 2 weeks?" + chcharge_4_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every 4 weeks?" + chcharge_monthly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every month?" + + rent_and_charges: + page_header: "Household rent and charges" + brent: + check_answer_label: "Basic rent" + hint_text: "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent." + question_text: "What is the basic rent?" + scharge: + check_answer_label: "Service charge" + hint_text: "For example, for cleaning. Households may receive housing benefit or Universal Credit towards the service charge." + question_text: "What is the service charge?" + pscharge: + check_answer_label: "Personal service charge" + hint_text: "For example, for heating or hot water. This doesn’t include housing benefit or Universal Credit." + question_text: "What is the personal service charge?" + supcharg: + check_answer_label: "Support charge" + hint_text: "Any charges made to fund support services included in tenancy agreement." + question_text: "What is the support charge?" + tcharge: + check_answer_label: "Household rent and charges" + hint_text: "This is the total for rent and all charges." + question_text: "Total charge" + + hbrentshortfall: + page_header: "" + check_answer_label: "Any outstanding amount for basic rent and charges" + hint_text: "Also known as the ‘outstanding amount’." + question_text: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?" + + outstanding_amount: + page_header: "" + tshortfall_known: + check_answer_label: "Do you know the outstanding amount?" + hint_text: "You only need to give an approximate figure." + question_text: "Can you estimate the outstanding amount?" + tshortfall: + check_answer_label: "Estimated outstanding amountt" + hint_text: "Also known as the ‘outstanding amount’." + question_text: "Estimated outstanding amount" diff --git a/config/locales/forms/2024/lettings/income_and_benefits.en.yml b/config/locales/forms/2024/lettings/income_and_benefits.en.yml new file mode 100644 index 000000000..bb3cc320e --- /dev/null +++ b/config/locales/forms/2024/lettings/income_and_benefits.en.yml @@ -0,0 +1,108 @@ +en: + forms: + 2024: + lettings: + income_and_benefits: + net_income_known: + page_header: "Household’s combined income after tax" + check_answer_label: "Do you know the household’s combined total income after tax?" + hint_text: "" + question_text: "Do you know the household’s combined income after tax?" + + income_amount: + page_header: "Total household income" + incfreq: + check_answer_label: "How often does the household receive this amount?" + hint_text: "" + question_text: "How often does the household receive this amount?" + earnings: + check_answer_label: "Total household income" + hint_text: "" + question_text: "How much income does the household have in total?" + + hb: + page_header: "" + check_answer_label: "Housing-related benefits received" + hint_text: "This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive." + question_text: "Is the household likely to be receiving any of these housing-related benefits?" + + benefits: + page_header: "" + check_answer_label: "Household income from Universal Credit, state pension or benefit" + hint_text: "This excludes child and housing benefit, council tax support and tax credits." + question_text: "How much of the household’s income is from Universal Credit, state pensions or benefits?" + + household_charge: + page_header: "" + check_answer_label: "Does the household pay rent or charges" + hint_text: "If rent is charged on the property then answer Yes to this question, even if the tenants do not pay it themselves." + question_text: "Does the household pay rent or other charges for the accommodation?" + + period: + page_header: "" + check_answer_label: "Frequency of household rent and charges" + hint_text: "Select how often the household is charged. This may be different to how often they pay." + question_text: "How often does the household pay rent and other charges?" + + care_home: + page_header: "" + is_carehome: + check_answer_label: "Care home accommodation" + hint_text: "" + question_text: "Is this accommodation a care home?" + chcharge_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every week?" + chcharge_bi_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every 2 weeks?" + chcharge_4_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every 4 weeks?" + chcharge_monthly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every month?" + + rent_and_charges: + page_header: "Household rent and charges" + brent: + check_answer_label: "Basic rent" + hint_text: "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent." + question_text: "What is the basic rent?" + scharge: + check_answer_label: "Service charge" + hint_text: "For example, for cleaning. Households may receive housing benefit or Universal Credit towards the service charge." + question_text: "What is the service charge?" + pscharge: + check_answer_label: "Personal service charge" + hint_text: "For example, for heating or hot water. This doesn’t include housing benefit or Universal Credit." + question_text: "What is the personal service charge?" + supcharg: + check_answer_label: "Support charge" + hint_text: "Any charges made to fund support services included in tenancy agreement." + question_text: "What is the support charge?" + tcharge: + check_answer_label: "Household rent and charges" + hint_text: "This is the total for rent and all charges." + question_text: "Total charge" + + hbrentshortfall: + page_header: "" + check_answer_label: "Any outstanding amount for basic rent and charges" + hint_text: "Also known as the ‘outstanding amount’." + question_text: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?" + + outstanding_amount: + page_header: "" + tshortfall_known: + check_answer_label: "Do you know the outstanding amount?" + hint_text: "You only need to give an approximate figure." + question_text: "Can you estimate the outstanding amount?" + tshortfall: + check_answer_label: "Estimated outstanding amountt" + hint_text: "Also known as the ‘outstanding amount’." + question_text: "Estimated outstanding amount" From 83e3ddccdd70f04685b67d9216a3c01dce826645 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:12:22 +0000 Subject: [PATCH 04/27] CLDC-3692: Extract lettings tenancy validations (#2743) * Extract lettings tenancy validations --- app/models/validations/tenancy_validations.rb | 39 ++++++++----------- config/locales/en.yml | 6 --- .../validations/lettings/tenancy.en.yml | 25 ++++++++++++ .../validations/tenancy_validations_spec.rb | 15 ++++--- 4 files changed, 49 insertions(+), 36 deletions(-) create mode 100644 config/locales/validations/lettings/tenancy.en.yml diff --git a/app/models/validations/tenancy_validations.rb b/app/models/validations/tenancy_validations.rb index bd55203fb..d08f8a071 100644 --- a/app/models/validations/tenancy_validations.rb +++ b/app/models/validations/tenancy_validations.rb @@ -10,10 +10,9 @@ module Validations::TenancyValidations min_tenancy_length = 1 return if record.tenancylength.to_i.between?(min_tenancy_length, 99) - message = I18n.t("validations.tenancy.length.invalid_fixed", min_tenancy_length:) - record.errors.add :needstype, message - record.errors.add :tenancylength, :tenancylength_invalid, message: message - record.errors.add :tenancy, message + record.errors.add :needstype, I18n.t("validations.lettings.tenancy.needstype.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :tenancylength, :tenancylength_invalid, message: I18n.t("validations.lettings.tenancy.tenancylength.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :tenancy, I18n.t("validations.lettings.tenancy.tenancy.invalid_fixed_tenancylength", min_tenancy_length:) end def validate_general_needs_fixed_tenancy_length_affordable_social_rent(record) @@ -23,11 +22,10 @@ module Validations::TenancyValidations min_tenancy_length = 2 return if record.tenancylength.to_i.between?(min_tenancy_length, 99) - message = I18n.t("validations.tenancy.length.invalid_fixed", min_tenancy_length:) - record.errors.add :needstype, message - record.errors.add :rent_type, message - record.errors.add :tenancylength, :tenancylength_invalid, message: message - record.errors.add :tenancy, message + record.errors.add :needstype, I18n.t("validations.lettings.tenancy.needstype.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :rent_type, I18n.t("validations.lettings.tenancy.rent_type.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :tenancylength, :tenancylength_invalid, message: I18n.t("validations.lettings.tenancy.tenancylength.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :tenancy, I18n.t("validations.lettings.tenancy.tenancy.invalid_fixed_tenancylength", min_tenancy_length:) end def validate_general_needs_fixed_tenancy_length_intermediate_rent(record) @@ -37,11 +35,10 @@ module Validations::TenancyValidations min_tenancy_length = 1 return if record.tenancylength.to_i.between?(min_tenancy_length, 99) - message = I18n.t("validations.tenancy.length.invalid_fixed", min_tenancy_length:) - record.errors.add :needstype, message - record.errors.add :rent_type, message - record.errors.add :tenancylength, :tenancylength_invalid, message: message - record.errors.add :tenancy, message + record.errors.add :needstype, I18n.t("validations.lettings.tenancy.needstype.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :rent_type, I18n.t("validations.lettings.tenancy.rent_type.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :tenancylength, :tenancylength_invalid, message: I18n.t("validations.lettings.tenancy.tenancylength.invalid_fixed_tenancylength", min_tenancy_length:) + record.errors.add :tenancy, I18n.t("validations.lettings.tenancy.tenancy.invalid_fixed_tenancylength", min_tenancy_length:) end def validate_periodic_tenancy_length(record) @@ -50,18 +47,16 @@ module Validations::TenancyValidations min_tenancy_length = 1 return if record.tenancylength.to_i.between?(min_tenancy_length, 99) - message = I18n.t("validations.tenancy.length.invalid_periodic", min_tenancy_length:) - record.errors.add :tenancylength, :tenancylength_invalid, message: message - record.errors.add :tenancy, message + record.errors.add :tenancylength, :tenancylength_invalid, message: I18n.t("validations.lettings.tenancy.tenancylength.invalid_periodic_tenancylength", min_tenancy_length:) + record.errors.add :tenancy, I18n.t("validations.lettings.tenancy.tenancy.invalid_periodic_tenancylength", min_tenancy_length:) end def validate_tenancy_length_blank_when_not_required(record) return if record.tenancylength.blank? return if record.tenancy_type_fixed_term? || record.is_periodic_tenancy? - message = I18n.t("validations.tenancy.length.fixed_term_not_required") - record.errors.add :tenancylength, :tenancylength_invalid, message: message - record.errors.add :tenancy, message + record.errors.add :tenancylength, :tenancylength_invalid, message: I18n.t("validations.lettings.tenancy.tenancylength.fixed_term_not_required") + record.errors.add :tenancy, I18n.t("validations.lettings.tenancy.tenancy.fixed_term_not_required") end def validate_other_tenancy_type(record) @@ -72,8 +67,8 @@ module Validations::TenancyValidations return unless record.collection_start_year && record.joint if record.hhmemb == 1 && record.joint == 1 && record.collection_start_year >= 2022 - record.errors.add :joint, :not_joint_tenancy, message: I18n.t("validations.tenancy.not_joint") - record.errors.add :hhmemb, I18n.t("validations.tenancy.joint_more_than_one_member") + record.errors.add :joint, :not_joint_tenancy, message: I18n.t("validations.lettings.tenancy.joint.sole_tenancy") + record.errors.add :hhmemb, I18n.t("validations.lettings.tenancy.joint.multiple_members_required") end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 52e2c18e9..3b1cbf872 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -541,14 +541,8 @@ en: nationality: "Select a valid nationality." tenancy: - length: - fixed_term_not_required: "You must only answer the length of the tenancy if it's fixed-term." - invalid_fixed: "Enter a tenancy length between %{min_tenancy_length} and 99 years for a tenancy of this type." - invalid_periodic: "Enter a tenancy length between %{min_tenancy_length} and 99 years (or don't specify the length) for a tenancy of this type." internal_transfer: "Answer must be secure tenancy as this tenancy is an internal transfer." cannot_be_internal_transfer: "Answer cannot be internal transfer as this is not a secure tenancy." - not_joint: "This cannot be a joint tenancy as you've told us there's only one person in the household." - joint_more_than_one_member: "There must be more than one person in the household as you've told us this is a joint tenancy." declaration: missing: diff --git a/config/locales/validations/lettings/tenancy.en.yml b/config/locales/validations/lettings/tenancy.en.yml new file mode 100644 index 000000000..4c053e9ae --- /dev/null +++ b/config/locales/validations/lettings/tenancy.en.yml @@ -0,0 +1,25 @@ +en: + validations: + lettings: + tenancy: + needstype: + invalid_fixed_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years for a tenancy of this type." + invalid_periodic_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years (or don't specify the length) for a tenancy of this type." + + tenancylength: + invalid_fixed_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years for a tenancy of this type." + invalid_periodic_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years (or don't specify the length) for a tenancy of this type." + fixed_term_not_required: "You must only answer the length of the tenancy if it's fixed-term." + + tenancy: + invalid_fixed_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years for a tenancy of this type." + invalid_periodic_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years (or don't specify the length) for a tenancy of this type." + fixed_term_not_required: "You must only answer the length of the tenancy if it's fixed-term." + + rent_type: + invalid_fixed_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years for a tenancy of this type." + invalid_periodic_tenancylength: "Enter a tenancy length between %{min_tenancy_length} and 99 years (or don't specify the length) for a tenancy of this type." + + joint: + sole_tenancy: "This cannot be a joint tenancy as you've told us there's only one person in the household." + multiple_members_required: "There must be more than one person in the household as you've told us this is a joint tenancy." diff --git a/spec/models/validations/tenancy_validations_spec.rb b/spec/models/validations/tenancy_validations_spec.rb index a41752616..751506c07 100644 --- a/spec/models/validations/tenancy_validations_spec.rb +++ b/spec/models/validations/tenancy_validations_spec.rb @@ -76,12 +76,12 @@ RSpec.describe Validations::TenancyValidations do { name: "assured shorthold", code: 4, - expected_error: ->(min_tenancy_length) { I18n.t("validations.tenancy.length.invalid_fixed", min_tenancy_length:) }, + expected_error: ->(min_tenancy_length) { I18n.t("validations.lettings.tenancy.tenancylength.invalid_fixed_tenancylength", min_tenancy_length:) }, }, { name: "secure fixed term", code: 6, - expected_error: ->(min_tenancy_length) { I18n.t("validations.tenancy.length.invalid_fixed", min_tenancy_length:) }, + expected_error: ->(min_tenancy_length) { I18n.t("validations.lettings.tenancy.tenancylength.invalid_fixed_tenancylength", min_tenancy_length:) }, }, ] @@ -211,7 +211,7 @@ RSpec.describe Validations::TenancyValidations do periodic_tenancy_case = { name: "periodic", code: 8, - expected_error: ->(min_tenancy_length) { I18n.t("validations.tenancy.length.invalid_periodic", min_tenancy_length:) }, + expected_error: ->(min_tenancy_length) { I18n.t("validations.lettings.tenancy.tenancylength.invalid_periodic_tenancylength", min_tenancy_length:) }, } error_fields = %w[tenancylength tenancy] include_examples "adds expected errors based on the tenancy length", periodic_tenancy_case, error_fields, 1 @@ -237,9 +237,8 @@ RSpec.describe Validations::TenancyValidations do it "adds errors to tenancylength and tenancy" do tenancy_validator.validate_tenancy_length_blank_when_not_required(record) - expected_error = I18n.t("validations.tenancy.length.fixed_term_not_required") - expect(record.errors["tenancylength"]).to include(expected_error) - expect(record.errors["tenancy"]).to include(expected_error) + expect(record.errors["tenancylength"]).to include(I18n.t("validations.lettings.tenancy.tenancylength.fixed_term_not_required")) + expect(record.errors["tenancy"]).to include(I18n.t("validations.lettings.tenancy.tenancy.fixed_term_not_required")) end end @@ -321,8 +320,8 @@ RSpec.describe Validations::TenancyValidations do describe "joint tenancy validation" do context "when the data inputter has said that there is only one member in the household" do let(:record) { FactoryBot.build(:lettings_log, :setup_completed, hhmemb: 1) } - let(:expected_error) { I18n.t("validations.tenancy.not_joint") } - let(:hhmemb_expected_error) { I18n.t("validations.tenancy.joint_more_than_one_member") } + let(:expected_error) { I18n.t("validations.lettings.tenancy.joint.sole_tenancy") } + let(:hhmemb_expected_error) { I18n.t("validations.lettings.tenancy.joint.multiple_members_required") } it "displays an error if the data inputter says the letting is a joint tenancy" do record.joint = 1 From 1e968e50a6af5b205d6e8977056adc6ad8b98b9d Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:06:28 +0000 Subject: [PATCH 05/27] CLDC-3694 Extract lettings BU validations --- .../bulk_upload/lettings/validator.rb | 10 +- .../lettings/year2023/row_parser.rb | 138 ++++++++--------- .../lettings/year2024/row_parser.rb | 144 +++++++++--------- app/services/bulk_upload/processor.rb | 27 ++-- config/locales/en.yml | 27 ---- .../lettings/2023/bulk_upload.en.yml | 56 +++++++ .../lettings/2024/bulk_upload.en.yml | 56 +++++++ .../lettings/year2023/row_parser_spec.rb | 126 +++++++-------- .../lettings/year2024/row_parser_spec.rb | 142 ++++++++--------- 9 files changed, 411 insertions(+), 315 deletions(-) create mode 100644 config/locales/validations/lettings/2023/bulk_upload.en.yml create mode 100644 config/locales/validations/lettings/2024/bulk_upload.en.yml diff --git a/app/services/bulk_upload/lettings/validator.rb b/app/services/bulk_upload/lettings/validator.rb index 4da5b2c40..116c3b745 100644 --- a/app/services/bulk_upload/lettings/validator.rb +++ b/app/services/bulk_upload/lettings/validator.rb @@ -158,7 +158,7 @@ private def validate_file_not_empty if File.size(path).zero? || csv_parser.body_rows.flatten.compact.empty? - errors.add(:base, :blank_file) + errors.add(:base, I18n.t("validations.lettings.#{@bulk_upload.year}.bulk_upload.blank_file")) halt_validations! end @@ -168,7 +168,7 @@ private return if halt_validations? unless csv_parser.correct_field_count? - errors.add(:base, :wrong_field_numbers_count) + errors.add(:base, I18n.t("validations.lettings.#{@bulk_upload.year}.bulk_upload.wrong_template.wrong_field_numbers_count")) halt_validations! end end @@ -177,7 +177,7 @@ private return if halt_validations? if csv_parser.too_many_columns? - errors.add(:base, :over_max_column_count) + errors.add(:base, I18n.t("validations.lettings.#{@bulk_upload.year}.bulk_upload.wrong_template.over_max_column_count")) halt_validations! end end @@ -185,14 +185,14 @@ private def validate_correct_template return if halt_validations? - errors.add(:base, :wrong_template) if csv_parser.wrong_template_for_year? + errors.add(:base, I18n.t("validations.lettings.#{@bulk_upload.year}.bulk_upload.wrong_template.wrong_template")) if csv_parser.wrong_template_for_year? end def validate_missing_required_headers return if halt_validations? if csv_parser.missing_required_headers? - errors.add :base, I18n.t("activemodel.errors.models.bulk_upload/lettings/validator.attributes.base.no_headers", guidance_link: bulk_upload_lettings_log_url(id: "guidance", form: { year: bulk_upload.year }, host: ENV["APP_HOST"], anchor: "using-the-bulk-upload-template")) + errors.add :base, I18n.t("validations.lettings.#{@bulk_upload.year}.bulk_upload.wrong_template.no_headers", guidance_link: bulk_upload_lettings_log_url(id: "guidance", form: { year: bulk_upload.year }, host: ENV["APP_HOST"], anchor: "using-the-bulk-upload-template")) halt_validations! end end diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 59cf7ea34..3424e0608 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -141,6 +141,8 @@ class BulkUpload::Lettings::Year2023::RowParser field_134: "What do you expect the outstanding amount to be?", }.freeze + ERROR_BASE_KEY = "validations.lettings.2023.bulk_upload".freeze + attribute :bulk_upload attribute :block_log_creation, :boolean, default: -> { false } @@ -285,12 +287,12 @@ class BulkUpload::Lettings::Year2023::RowParser validates :field_5, presence: { - message: I18n.t("validations.not_answered", question: "letting type."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "letting type."), category: :setup, }, inclusion: { in: (1..12).to_a, - message: I18n.t("validations.invalid_option", question: "letting type."), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "letting type."), unless: -> { field_5.blank? }, category: :setup, }, @@ -298,33 +300,33 @@ class BulkUpload::Lettings::Year2023::RowParser validates :field_6, presence: { - message: I18n.t("validations.not_answered", question: "property renewal."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "property renewal."), category: :setup, }, on: :after_log validates :field_7, presence: { - message: I18n.t("validations.not_answered", question: "tenancy start date (day)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "tenancy start date (day)."), category: :setup, }, on: :after_log validates :field_8, presence: { - message: I18n.t("validations.not_answered", question: "tenancy start date (month)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "tenancy start date (month)."), category: :setup, }, on: :after_log validates :field_9, presence: { - message: I18n.t("validations.not_answered", question: "tenancy start date (year)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "tenancy start date (year)."), category: :setup, }, format: { with: /\A(\d{2}|\d{4})\z/, - message: I18n.t("validations.setup.startdate.year_not_two_or_four_digits"), + message: I18n.t("#{ERROR_BASE_KEY}.startdate.year_not_two_or_four_digits"), category: :setup, unless: -> { field_9.blank? }, }, @@ -333,55 +335,55 @@ class BulkUpload::Lettings::Year2023::RowParser validates :field_16, presence: { if: proc { supported_housing? }, - message: I18n.t("validations.not_answered", question: "scheme code."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "scheme code."), category: :setup, }, on: :after_log validates :field_116, presence: { - message: I18n.t("validations.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?"), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?"), category: :not_answered, }, inclusion: { in: [1, 2], - message: I18n.t("validations.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?"), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?"), if: -> { field_116.present? }, }, on: :after_log validates :field_117, presence: { - message: I18n.t("validations.not_answered", question: "was the letting made under the Common Allocation Policy (CAP)?"), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Allocation Policy (CAP)?"), category: :not_answered, }, inclusion: { in: [1, 2], - message: I18n.t("validations.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?"), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?"), if: -> { field_117.present? }, }, on: :after_log validates :field_118, presence: { - message: I18n.t("validations.not_answered", question: "was the letting made under the Common Housing Register (CHR)?"), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Housing Register (CHR)?"), category: :not_answered, }, inclusion: { in: [1, 2], - message: I18n.t("validations.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?"), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?"), if: -> { field_118.present? }, }, on: :after_log - validates :field_46, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 1 must be a number or the letter R" }, on: :after_log - validates :field_52, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 2 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(2).zero? } - validates :field_56, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 3 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(3).zero? } - validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 4 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(4).zero? } - validates :field_64, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 5 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(5).zero? } - validates :field_68, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 6 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(6).zero? } - validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 7 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(7).zero? } - validates :field_76, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 8 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(8).zero? } + validates :field_46, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 1) }, on: :after_log + validates :field_52, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 2) }, on: :after_log, if: proc { details_known?(2).zero? } + validates :field_56, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 3) }, on: :after_log, if: proc { details_known?(3).zero? } + validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 4) }, on: :after_log, if: proc { details_known?(4).zero? } + validates :field_64, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 5) }, on: :after_log, if: proc { details_known?(5).zero? } + validates :field_68, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 6) }, on: :after_log, if: proc { details_known?(6).zero? } + validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 7) }, on: :after_log, if: proc { details_known?(7).zero? } + validates :field_76, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 8) }, on: :after_log, if: proc { details_known?(8).zero? } validate :validate_needs_type_present, on: :after_log validate :validate_data_types, on: :after_log @@ -521,7 +523,7 @@ class BulkUpload::Lettings::Year2023::RowParser def add_duplicate_found_in_spreadsheet_errors spreadsheet_duplicate_hash.each_key do |field| - errors.add(field, :spreadsheet_dupe, category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup) end end @@ -529,7 +531,7 @@ private def validate_declaration_acceptance unless field_45 == 1 - errors.add(:field_45, I18n.t("validations.declaration.missing.pre_2024"), category: :setup) + errors.add(:field_45, I18n.t("#{ERROR_BASE_KEY}.declaration.missing"), category: :setup) end end @@ -544,9 +546,9 @@ private fields.each do |field| if setup_question?(question) - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) else - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field]))) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field]))) end end end @@ -556,7 +558,7 @@ private return if field_3.blank? unless assigned_to - errors.add(:field_3, "User with the specified email could not be found.") + errors.add(:field_3, I18n.t("#{ERROR_BASE_KEY}.assigned_to.not_found")) end end @@ -566,7 +568,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_3, "User must be related to owning organisation or managing organisation.") + errors.add(:field_3, I18n.t("#{ERROR_BASE_KEY}.assigned_to.organisation_not_related")) end def assigned_to @@ -575,7 +577,7 @@ private def validate_uprn_exists_if_any_key_address_fields_are_blank if field_18.blank? && (field_19.blank? || field_21.blank?) - errors.add(:field_18, I18n.t("validations.not_answered", question: "UPRN."), category: :not_answered) + errors.add(:field_18, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "UPRN."), category: :not_answered) end end @@ -614,21 +616,21 @@ private def validate_needs_type_present if field_4.blank? - errors.add(:field_4, I18n.t("validations.not_answered", question: "needs type."), category: :setup) + errors.add(:field_4, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "needs type."), category: :setup) end end def validate_no_and_dont_know_disabled_needs_conjunction if field_87 == 1 && field_88 == 1 - errors.add(:field_87, I18n.t("validations.household.housingneeds.no_and_dont_know_disabled_needs_conjunction")) - errors.add(:field_88, I18n.t("validations.household.housingneeds.no_and_dont_know_disabled_needs_conjunction")) + errors.add(:field_87, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) + errors.add(:field_88, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) end end def validate_dont_know_disabled_needs_conjunction if field_88 == 1 && [field_83, field_84, field_85, field_86].count(1).positive? %i[field_88 field_83 field_84 field_85 field_86].each do |field| - errors.add(field, I18n.t("validations.household.housingneeds.dont_know_disabled_needs_conjunction")) if send(field) == 1 + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.dont_know_disabled_needs_conjunction")) if send(field) == 1 end end end @@ -636,7 +638,7 @@ private def validate_no_disabled_needs_conjunction if field_87 == 1 && [field_83, field_84, field_85, field_86].count(1).positive? %i[field_87 field_83 field_84 field_85 field_86].each do |field| - errors.add(field, I18n.t("validations.household.housingneeds.no_disabled_needs_conjunction")) if send(field) == 1 + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_disabled_needs_conjunction")) if send(field) == 1 end end end @@ -644,17 +646,17 @@ private def validate_only_one_housing_needs_type if [field_83, field_84, field_85].count(1) > 1 %i[field_83 field_84 field_85].each do |field| - errors.add(field, I18n.t("validations.household.housingneeds_type.only_one_option_permitted")) if send(field) == 1 + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds_type.only_one_option_permitted")) if send(field) == 1 end end end def validate_no_housing_needs_questions_answered if [field_83, field_84, field_85, field_86, field_87, field_88].all?(&:blank?) - errors.add(:field_87, I18n.t("validations.not_answered", question: "anybody with disabled access needs."), category: :not_answered) - errors.add(:field_86, I18n.t("validations.not_answered", question: "other access needs."), category: :not_answered) + errors.add(:field_87, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "anybody with disabled access needs."), category: :not_answered) + errors.add(:field_86, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "other access needs."), category: :not_answered) %i[field_83 field_84 field_85].each do |field| - errors.add(field, I18n.t("validations.not_answered", question: "disabled access needs type."), category: :not_answered) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "disabled access needs type."), category: :not_answered) end end end @@ -663,7 +665,7 @@ private reason_fields = %i[field_111 field_112 field_113 field_114 field_115] if field_110 == 1 && reason_fields.all? { |field| attributes[field.to_s].blank? } reason_fields.each do |field| - errors.add(field, I18n.t("validations.not_answered", question: "reason for reasonable preference."), category: :not_answered) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "reason for reasonable preference."), category: :not_answered) end end end @@ -673,12 +675,12 @@ private if household_no_illness? illness_option_fields.each do |field| if attributes[field.to_s] == 1 - errors.add(field, I18n.t("validations.household.condition_effects.no_choices")) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.condition_effects.no_choices")) end end elsif illness_option_fields.all? { |field| attributes[field.to_s].blank? } illness_option_fields.each do |field| - errors.add(field, I18n.t("validations.not_answered", question: "how is person affected by condition or illness."), category: :not_answered) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "how is person affected by condition or illness."), category: :not_answered) end end end @@ -690,20 +692,20 @@ private def validate_lettings_type_matches_bulk_upload if [1, 3, 5, 7, 9, 11].include?(field_5) && !general_needs? block_log_creation! - errors.add(:field_4, I18n.t("validations.setup.needstype.lettype_not_supported_housing"), category: :setup) - errors.add(:field_5, I18n.t("validations.setup.lettype.needstype_supported_housing"), category: :setup) + errors.add(:field_4, I18n.t("#{ERROR_BASE_KEY}.needstype.lettype_not_supported_housing"), category: :setup) + errors.add(:field_5, I18n.t("#{ERROR_BASE_KEY}.lettype.needstype_supported_housing"), category: :setup) end if [2, 4, 6, 8, 10, 12].include?(field_5) && !supported_housing? block_log_creation! - errors.add(:field_4, I18n.t("validations.setup.needstype.lettype_not_general_needs"), category: :setup) - errors.add(:field_5, I18n.t("validations.setup.lettype.needstype_general_needs"), category: :setup) + errors.add(:field_4, I18n.t("#{ERROR_BASE_KEY}.needstype.lettype_not_general_needs"), category: :setup) + errors.add(:field_5, I18n.t("#{ERROR_BASE_KEY}.lettype.needstype_general_needs"), category: :setup) end end def validate_leaving_reason_for_renewal if field_6 == 1 && ![40, 42].include?(field_102) - errors.add(:field_102, I18n.t("validations.household.reason.renewal_reason_needed")) + errors.add(:field_102, I18n.t("#{ERROR_BASE_KEY}.reason.renewal_reason_needed")) end end @@ -717,13 +719,13 @@ private def validate_cannot_be_la_referral_if_general_needs_and_la if field_119 == 4 && general_needs? && owning_organisation && owning_organisation.la? - errors.add :field_119, I18n.t("validations.household.referral.la_general_needs.prp_referred_by_la") + errors.add :field_119, I18n.t("#{ERROR_BASE_KEY}.referral.general_needs_prp_referred_by_la") end end def validate_la_with_local_housing_referral if field_119 == 3 && owning_organisation && owning_organisation.la? - errors.add(:field_119, I18n.t("validations.household.referral.nominated_by_local_ha_but_la")) + errors.add(:field_119, I18n.t("#{ERROR_BASE_KEY}.referral.nominated_by_local_ha_but_la")) end end @@ -731,15 +733,15 @@ private return if startdate.blank? || bulk_upload.form.blank? unless bulk_upload.form.valid_start_date_for_form?(startdate) - errors.add(:field_7, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_8, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_9, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_7, I18n.t("#{ERROR_BASE_KEY}.startdate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_8, I18n.t("#{ERROR_BASE_KEY}.startdate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_9, I18n.t("#{ERROR_BASE_KEY}.startdate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) end end def validate_data_types unless attribute_set["field_5"].value_before_type_cast&.match?(/^\d+\.?0*$/) - errors.add(:field_5, I18n.t("validations.invalid_number", question: "letting type.")) + errors.add(:field_5, I18n.t("#{ERROR_BASE_KEY}.invalid_number", question: "letting type.")) end end @@ -756,14 +758,14 @@ private fields.each do |field| if errors.select { |e| fields.include?(e.attribute) }.none? question_text = question.error_display_label.presence || "this question." - errors.add(field, I18n.t("validations.not_answered", question: format_ending(question_text)), category: :setup) if field.present? + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: format_ending(question_text)), category: :setup) if field.present? end end else fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } question_text = question.error_display_label.presence || "this question." - errors.add(field, I18n.t("validations.not_answered", question: format_ending(question_text)), category: :not_answered) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: format_ending(question_text)), category: :not_answered) end end end @@ -773,28 +775,28 @@ private def validate_related_location_exists if scheme && location_id.present? && location.nil? && location_field.present? block_log_creation! - errors.add(location_field, "#{location_or_scheme.capitalize} code must relate to a #{location_or_scheme} that is owned by the owning organisation or managing organisation.", category: :setup) + errors.add(location_field, I18n.t("#{ERROR_BASE_KEY}.scheme.must_relate_to_org", capitalised_location_or_scheme: location_or_scheme.capitalize, location_or_scheme:), category: :setup) end end def validate_location_data_given if supported_housing? && location_id.blank? && location_field.present? block_log_creation! - errors.add(location_field, I18n.t("validations.not_answered", question: "#{location_or_scheme} code."), category: :setup) + errors.add(location_field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "#{location_or_scheme} code."), category: :setup) end end def validate_related_scheme_exists if scheme_id.present? && scheme_field.present? && owning_organisation.present? && managing_organisation.present? && scheme.nil? block_log_creation! - errors.add(scheme_field, "This #{scheme_or_management_group} code does not belong to the owning organisation or managing organisation.", category: :setup) + errors.add(scheme_field, I18n.t("#{ERROR_BASE_KEY}.scheme.does_not_belong_to_org", scheme_or_management_group:), category: :setup) end end def validate_scheme_data_given if supported_housing? && scheme_field.present? && scheme_id.blank? block_log_creation! - errors.add(scheme_field, I18n.t("validations.not_answered", question: "#{scheme_or_management_group} code."), category: :setup) + errors.add(scheme_field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "#{scheme_or_management_group} code."), category: :setup) end end @@ -803,7 +805,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This managing organisation does not have a relationship with the owning organisation.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.managing_organisation.no_relationship"), category: :setup) end end end @@ -813,7 +815,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "The managing organisation code is incorrect.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.managing_organisation.not_found"), category: :setup) end end end @@ -821,7 +823,7 @@ private def validate_managing_org_data_given if field_2.blank? block_log_creation! - errors.add(:field_2, "The managing organisation code is incorrect.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.managing_organisation.not_answered"), category: :setup) end end @@ -830,7 +832,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_stock_owner"), category: :setup) end end end @@ -840,7 +842,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_found"), category: :setup) end end end @@ -848,7 +850,7 @@ private def validate_owning_org_data_given if field_1.blank? block_log_creation! - errors.add(:field_1, I18n.t("validations.not_answered", question: "owning organisation."), category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "owning organisation."), category: :setup) end end @@ -857,20 +859,20 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_permitted"), category: :setup) end end end def validate_correct_intermediate_rent_type if field_11.blank? || ![1, 2, 3].include?(field_11.to_i) - errors.add(:field_11, I18n.t("validations.not_answered", question: "intermediate rent type."), category: :setup) + errors.add(:field_11, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "intermediate rent type."), category: :setup) end end def validate_correct_affordable_rent_type if field_10.blank? || ![1, 2, 3].include?(field_10.to_i) - errors.add(:field_10, I18n.t("validations.not_answered", question: "is this a London Affordable Rent letting."), category: :setup) + errors.add(:field_10, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "is this a London Affordable Rent letting."), category: :setup) end end @@ -880,7 +882,7 @@ private def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log." + error_message = I18n.t("#{ERROR_BASE_KEY}.duplicate") errors.add(:field_1, error_message) # owning_organisation errors.add(:field_7, error_message) # startdate diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index 312a5472a..ef7433614 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -146,6 +146,8 @@ class BulkUpload::Lettings::Year2024::RowParser 6 => 5, }.freeze + ERROR_BASE_KEY = "validations.lettings.2024.bulk_upload".freeze + attribute :bulk_upload attribute :block_log_creation, :boolean, default: -> { false } @@ -286,12 +288,12 @@ class BulkUpload::Lettings::Year2024::RowParser validates :field_11, presence: { - message: I18n.t("validations.not_answered", question: "rent type."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "rent type."), category: :setup, }, inclusion: { in: (1..6).to_a, - message: I18n.t("validations.invalid_option", question: "rent type."), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "rent type."), unless: -> { field_11.blank? }, category: :setup, }, @@ -299,33 +301,33 @@ class BulkUpload::Lettings::Year2024::RowParser validates :field_7, presence: { - message: I18n.t("validations.not_answered", question: "property renewal."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "property renewal."), category: :setup, }, on: :after_log validates :field_8, presence: { - message: I18n.t("validations.not_answered", question: "tenancy start date (day)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "tenancy start date (day)."), category: :setup, }, on: :after_log validates :field_9, presence: { - message: I18n.t("validations.not_answered", question: "tenancy start date (month)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "tenancy start date (month)."), category: :setup, }, on: :after_log validates :field_10, presence: { - message: I18n.t("validations.not_answered", question: "tenancy start date (year)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "tenancy start date (year)."), category: :setup, }, format: { with: /\A(\d{2}|\d{4})\z/, - message: I18n.t("validations.setup.startdate.year_not_two_or_four_digits"), + message: I18n.t("#{ERROR_BASE_KEY}.startdate.year_not_two_or_four_digits"), category: :setup, unless: -> { field_10.blank? }, }, @@ -334,7 +336,7 @@ class BulkUpload::Lettings::Year2024::RowParser validates :field_5, presence: { if: proc { supported_housing? }, - message: I18n.t("validations.not_answered", question: "scheme code."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "scheme code."), category: :setup, }, on: :after_log @@ -342,67 +344,67 @@ class BulkUpload::Lettings::Year2024::RowParser validates :field_6, presence: { if: proc { supported_housing? }, - message: I18n.t("validations.not_answered", question: "location code."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "location code."), category: :setup, }, on: :after_log validates :field_112, presence: { - message: I18n.t("validations.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?"), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?"), category: :not_answered, }, inclusion: { in: [1, 2], - message: I18n.t("validations.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?"), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?"), if: -> { field_112.present? }, }, on: :after_log validates :field_113, presence: { - message: I18n.t("validations.not_answered", question: "was the letting made under the Common Allocation Policy (CAP)?"), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Allocation Policy (CAP)?"), category: :not_answered, }, inclusion: { in: [1, 2], - message: I18n.t("validations.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?"), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?"), if: -> { field_113.present? }, }, on: :after_log validates :field_114, presence: { - message: I18n.t("validations.not_answered", question: "was the letting made under the Common Housing Register (CHR)?"), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Housing Register (CHR)?"), category: :not_answered, }, inclusion: { in: [1, 2], - message: I18n.t("validations.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?"), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?"), if: -> { field_114.present? }, }, on: :after_log validates :field_115, presence: { - message: I18n.t("validations.not_answered", question: "was the letting made under the Accessible Register?"), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Accessible Register?"), category: :not_answered, }, inclusion: { in: [1, 2], - message: I18n.t("validations.invalid_option", question: "was the letting made under the Accessible Register?"), + message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Accessible Register?"), if: -> { field_115.present? }, }, on: :after_log - validates :field_42, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 1 must be a number or the letter R" }, on: :after_log - validates :field_48, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 2 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(2).zero? } - validates :field_52, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 3 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(3).zero? } - validates :field_56, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 4 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(4).zero? } - validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 5 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(5).zero? } - validates :field_64, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 6 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(6).zero? } - validates :field_68, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 7 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(7).zero? } - validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: "Age of person 8 must be a number or the letter R" }, on: :after_log, if: proc { details_known?(8).zero? } + validates :field_42, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 1) }, on: :after_log + validates :field_48, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 2) }, on: :after_log, if: proc { details_known?(2).zero? } + validates :field_52, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 3) }, on: :after_log, if: proc { details_known?(3).zero? } + validates :field_56, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 4) }, on: :after_log, if: proc { details_known?(4).zero? } + validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 5) }, on: :after_log, if: proc { details_known?(5).zero? } + validates :field_64, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 6) }, on: :after_log, if: proc { details_known?(6).zero? } + validates :field_68, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 7) }, on: :after_log, if: proc { details_known?(7).zero? } + validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 8) }, on: :after_log, if: proc { details_known?(8).zero? } validate :validate_needs_type_present, on: :after_log validate :validate_data_types, on: :after_log @@ -547,10 +549,10 @@ class BulkUpload::Lettings::Year2024::RowParser spreadsheet_duplicate_hash.each_key do |field| if field == "tcharge" %w[field_125 field_126 field_127 field_128].each do |sub_field| - errors.add(sub_field, :spreadsheet_dupe, category: :setup) + errors.add(sub_field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup) end else - errors.add(field, :spreadsheet_dupe, category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup) end end end @@ -568,9 +570,9 @@ private fields.each do |field| if setup_question?(question) - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) else - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field]))) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field]))) end end end @@ -580,13 +582,13 @@ private return if field_3.blank? unless assigned_to - errors.add(:field_3, "User with the specified email could not be found.") + errors.add(:field_3, I18n.t("#{ERROR_BASE_KEY}.assigned_to.not_found")) end end def validate_assigned_to_when_support if field_3.blank? && bulk_upload.user.support? - errors.add(:field_3, category: :setup, message: I18n.t("validations.not_answered", question: "what is the CORE username of the account this letting log should be assigned to?")) + errors.add(:field_3, category: :setup, message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "what is the CORE username of the account this letting log should be assigned to?")) end end @@ -596,7 +598,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_3, "User must be related to owning organisation or managing organisation.") + errors.add(:field_3, I18n.t("#{ERROR_BASE_KEY}.assigned_to.organisation_not_related")) end def assigned_to @@ -605,14 +607,14 @@ private def validate_uprn_exists_if_any_key_address_fields_are_blank if field_16.blank? && !key_address_fields_provided? - errors.add(:field_16, I18n.t("validations.not_answered", question: "UPRN.")) + errors.add(:field_16, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "UPRN.")) end end def validate_address_option_found if log.uprn.nil? && field_16.blank? && key_address_fields_provided? %i[field_17 field_18 field_19 field_20 field_21 field_22].each do |field| - errors.add(field, I18n.t("validations.no_address_found")) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.address.not_found")) end end end @@ -624,19 +626,19 @@ private def validate_address_fields if field_16.blank? || log.errors.attribute_names.include?(:uprn) if field_17.blank? - errors.add(:field_17, I18n.t("validations.not_answered", question: "address line 1.")) + errors.add(:field_17, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "address line 1.")) end if field_19.blank? - errors.add(:field_19, I18n.t("validations.not_answered", question: "town or city.")) + errors.add(:field_19, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "town or city.")) end if field_21.blank? - errors.add(:field_21, I18n.t("validations.not_answered", question: "part 1 of postcode.")) + errors.add(:field_21, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "part 1 of postcode.")) end if field_22.blank? - errors.add(:field_22, I18n.t("validations.not_answered", question: "part 2 of postcode.")) + errors.add(:field_22, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "part 2 of postcode.")) end end end @@ -661,7 +663,7 @@ private def validate_nationality if field_45.present? && !valid_nationality_options.include?(field_45.to_s) - errors.add(:field_45, I18n.t("validations.household.nationality")) + errors.add(:field_45, I18n.t("#{ERROR_BASE_KEY}.nationality.invalid")) end end @@ -682,21 +684,21 @@ private def validate_needs_type_present if field_4.blank? - errors.add(:field_4, I18n.t("validations.not_answered", question: "needs type."), category: :setup) + errors.add(:field_4, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "needs type."), category: :setup) end end def validate_no_and_dont_know_disabled_needs_conjunction if field_83 == 1 && field_84 == 1 - errors.add(:field_83, I18n.t("validations.household.housingneeds.no_and_dont_know_disabled_needs_conjunction")) - errors.add(:field_84, I18n.t("validations.household.housingneeds.no_and_dont_know_disabled_needs_conjunction")) + errors.add(:field_83, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) + errors.add(:field_84, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) end end def validate_dont_know_disabled_needs_conjunction if field_84 == 1 && [field_79, field_80, field_81, field_82].count(1).positive? %i[field_84 field_79 field_80 field_81 field_82].each do |field| - errors.add(field, I18n.t("validations.household.housingneeds.dont_know_disabled_needs_conjunction")) if send(field) == 1 + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.dont_know_disabled_needs_conjunction")) if send(field) == 1 end end end @@ -704,7 +706,7 @@ private def validate_no_disabled_needs_conjunction if field_83 == 1 && [field_79, field_80, field_81, field_82].count(1).positive? %i[field_83 field_79 field_80 field_81 field_82].each do |field| - errors.add(field, I18n.t("validations.household.housingneeds.no_disabled_needs_conjunction")) if send(field) == 1 + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_disabled_needs_conjunction")) if send(field) == 1 end end end @@ -712,17 +714,17 @@ private def validate_only_one_housing_needs_type if [field_79, field_80, field_81].count(1) > 1 %i[field_79 field_80 field_81].each do |field| - errors.add(field, I18n.t("validations.household.housingneeds_type.only_one_option_permitted")) if send(field) == 1 + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds_type.only_one_option_permitted")) if send(field) == 1 end end end def validate_no_housing_needs_questions_answered if [field_79, field_80, field_81, field_82, field_83, field_84].all?(&:blank?) - errors.add(:field_83, I18n.t("validations.not_answered", question: "anybody with disabled access needs.")) - errors.add(:field_82, I18n.t("validations.not_answered", question: "other access needs.")) + errors.add(:field_83, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "anybody with disabled access needs.")) + errors.add(:field_82, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "other access needs.")) %i[field_79 field_80 field_81].each do |field| - errors.add(field, I18n.t("validations.not_answered", question: "disabled access needs type.")) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "disabled access needs type.")) end end end @@ -731,7 +733,7 @@ private reason_fields = %i[field_107 field_108 field_109 field_110 field_111] if field_106 == 1 && reason_fields.all? { |field| attributes[field.to_s].blank? } reason_fields.each do |field| - errors.add(field, I18n.t("validations.not_answered", question: "reason for reasonable preference.")) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "reason for reasonable preference.")) end end end @@ -741,12 +743,12 @@ private if household_no_illness? illness_option_fields.each do |field| if attributes[field.to_s] == 1 - errors.add(field, I18n.t("validations.household.condition_effects.no_choices")) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.condition_effects.no_choices")) end end elsif illness_option_fields.all? { |field| attributes[field.to_s].blank? } illness_option_fields.each do |field| - errors.add(field, I18n.t("validations.not_answered", question: "how is person affected by condition or illness.")) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "how is person affected by condition or illness.")) end end end @@ -757,7 +759,7 @@ private def validate_leaving_reason_for_renewal if field_7 == 1 && ![50, 51, 52, 53].include?(field_98) - errors.add(:field_98, I18n.t("validations.household.reason.renewal_reason_needed_2024")) + errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.reason.renewal_reason_needed")) end end @@ -771,13 +773,13 @@ private def validate_cannot_be_la_referral_if_general_needs_and_la if field_116 == 4 && general_needs? && owning_organisation && owning_organisation.la? - errors.add :field_116, I18n.t("validations.household.referral.la_general_needs.prp_referred_by_la") + errors.add :field_116, I18n.t("#{ERROR_BASE_KEY}.referral.general_needs_prp_referred_by_la") end end def validate_la_with_local_housing_referral if field_116 == 3 && owning_organisation && owning_organisation.la? - errors.add(:field_116, I18n.t("validations.household.referral.nominated_by_local_ha_but_la")) + errors.add(:field_116, I18n.t("#{ERROR_BASE_KEY}.referral.nominated_by_local_ha_but_la")) end end @@ -785,15 +787,15 @@ private return if startdate.blank? || bulk_upload.form.blank? unless bulk_upload.form.valid_start_date_for_form?(startdate) - errors.add(:field_8, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_9, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_10, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_8, I18n.t("#{ERROR_BASE_KEY}.startdate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_9, I18n.t("#{ERROR_BASE_KEY}.startdate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_10, I18n.t("#{ERROR_BASE_KEY}.startdate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) end end def validate_data_types unless attribute_set["field_11"].value_before_type_cast&.match?(/^\d+\.?0*$/) - errors.add(:field_11, I18n.t("validations.invalid_number", question: "rent type.")) + errors.add(:field_11, I18n.t("#{ERROR_BASE_KEY}.invalid_number", question: "rent type.")) end end @@ -825,14 +827,14 @@ private def validate_related_location_exists if scheme && field_6.present? && location.nil? && :field_6.present? block_log_creation! - errors.add(:field_6, "Location code must relate to a location that is owned by the owning organisation or managing organisation.", category: :setup) + errors.add(:field_6, I18n.t("#{ERROR_BASE_KEY}.location.must_relate_to_org"), category: :setup) end end def validate_related_scheme_exists if field_5.present? && :field_5.present? && owning_organisation.present? && managing_organisation.present? && scheme.nil? block_log_creation! - errors.add(:field_5, "This scheme code does not belong to the owning organisation or managing organisation.", category: :setup) + errors.add(:field_5, I18n.t("#{ERROR_BASE_KEY}.scheme.must_relate_to_org"), category: :setup) end end @@ -841,7 +843,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This managing organisation does not have a relationship with the owning organisation.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.managing_organisation.no_relationship"), category: :setup) end end end @@ -851,7 +853,7 @@ private block_log_creation! if field_2.present? && errors[:field_2].blank? - errors.add(:field_2, "The managing organisation code is incorrect.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.managing_organisation.not_found"), category: :setup) end end end @@ -859,7 +861,7 @@ private def validate_managing_org_data_given if field_2.blank? block_log_creation! - errors.add(:field_2, I18n.t("validations.not_answered", question: "managing organisation."), category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "managing organisation."), category: :setup) end end @@ -868,7 +870,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_stock_owner"), category: :setup) end end end @@ -878,7 +880,7 @@ private block_log_creation! if field_1.present? && errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_found"), category: :setup) end end end @@ -886,7 +888,7 @@ private def validate_owning_org_data_given if field_1.blank? block_log_creation! - errors.add(:field_1, I18n.t("validations.not_answered", question: "owning organisation."), category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "owning organisation."), category: :setup) end end @@ -899,9 +901,9 @@ private return if errors[:field_1].present? if bulk_upload.user.support? - errors.add(:field_1, "This owning organisation is not affiliated with #{bulk_upload_organisation.name}.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_permitted.support", org_name: bulk_upload_organisation.name), category: :setup) else - errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_permitted.not_support"), category: :setup) end end @@ -916,12 +918,12 @@ private }.partition { |field, _| public_send(field).blank? }.map(&:to_h) blank_charge_fields.each do |field, charge| - errors.add(field, I18n.t("validations.financial.charges.missing_charges", sentence_fragment: charge)) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.charges.missing_charges", sentence_fragment: charge)) end other_charge_fields.each do |field, _charge| blank_charge_fields.each do |_blank_field, blank_charge| - errors.add(field, I18n.t("validations.financial.charges.missing_charges", sentence_fragment: blank_charge)) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.charges.missing_charges", sentence_fragment: blank_charge)) end end end @@ -936,7 +938,7 @@ private def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log." + error_message = I18n.t("#{ERROR_BASE_KEY}.duplicate") errors.add(:field_1, error_message) # owning_organisation errors.add(:field_8, error_message) # startdate diff --git a/app/services/bulk_upload/processor.rb b/app/services/bulk_upload/processor.rb index 83a8d1ca0..3a6ef4a33 100644 --- a/app/services/bulk_upload/processor.rb +++ b/app/services/bulk_upload/processor.rb @@ -1,15 +1,22 @@ class BulkUpload::Processor + include CollectionTimeHelper attr_reader :bulk_upload - BLANK_TEMPLATE_ERRORS = [ - I18n.t("activemodel.errors.models.bulk_upload/lettings/validator.attributes.base.blank_file"), - I18n.t("activemodel.errors.models.bulk_upload/sales/validator.attributes.base.blank_file"), - ].freeze + def blank_template_errors + [ + I18n.t("validations.lettings.#{current_collection_start_year}.bulk_upload.blank_file"), + I18n.t("validations.lettings.#{previous_collection_start_year}.bulk_upload.blank_file"), + I18n.t("activemodel.errors.models.bulk_upload/sales/validator.attributes.base.blank_file"), + ].freeze + end - WRONG_TEMPLATE_ERRORS = [ - *I18n.t("activemodel.errors.models.bulk_upload/lettings/validator.attributes.base", default: {}).values, - *I18n.t("activemodel.errors.models.bulk_upload/sales/validator.attributes.base", default: {}).values, - ].freeze + def wrong_template_errors + [ + *I18n.t("validations.lettings.#{current_collection_start_year}.bulk_upload.wrong_template", default: {}).values, + *I18n.t("validations.lettings.#{previous_collection_start_year}.bulk_upload.wrong_template", default: {}).values, + *I18n.t("activemodel.errors.models.bulk_upload/sales/validator.attributes.base", default: {}).values, + ].freeze + end def initialize(bulk_upload:) @bulk_upload = bulk_upload @@ -157,9 +164,9 @@ private end def handle_invalid_validator - if BLANK_TEMPLATE_ERRORS.any? { |error| validator.errors.full_messages.include?(error) } + if blank_template_errors.any? { |error| validator.errors.full_messages.include?(error) } @bulk_upload.update!(failure_reason: "blank_template") - elsif WRONG_TEMPLATE_ERRORS.any? { |error| validator.errors.full_messages.include?(error) } + elsif wrong_template_errors.any? { |error| validator.errors.full_messages.include?(error) } @bulk_upload.update!(failure_reason: "wrong_template") end diff --git a/config/locales/en.yml b/config/locales/en.yml index 3b1cbf872..63d80d418 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -61,14 +61,6 @@ en: <<: *bulk_upload__row_parser__base bulk_upload/sales/year2023/row_parser: <<: *bulk_upload__row_parser__base - bulk_upload/lettings/validator: - attributes: - base: - blank_file: "Template is blank - The template must be filled in for us to create the logs and check if data is correct." - wrong_field_numbers_count: "Incorrect number of fields, please ensure you have used the correct template." - over_max_column_count: "Too many columns, please ensure you have used the correct template." - wrong_template: "Incorrect start dates, please ensure you have used the correct template." - no_headers: "Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})." bulk_upload/sales/validator: attributes: base: @@ -290,7 +282,6 @@ en: startdate: before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme." - year_not_two_or_four_digits: "Tenancy start year must be 2 or 4 digits." location: deactivated: startdate: "The location %{postcode} is inactive on this date. Enter another date or choose another location." @@ -313,15 +304,6 @@ en: scheme_id: "The scheme %{name} has no locations that are active on this date. Enter another date or choose another scheme." owning_organisation: data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation." - lettype: - general_needs_mismatch: "Lettings type must be a general needs type because you selected general needs when uploading the file." - supported_housing_mismatch: "Lettings type must be a supported housing type because you selected supported housing when uploading the file." - needstype_general_needs: "This needs type is general needs, but the letting type is supported housing. Change either the needs type or the letting type." - needstype_supported_housing: "This needs type is supported housing, but the letting type is general needs. Change either the needs type or the letting type." - needstype: - lettype_not_general_needs: "This letting type is supported housing, but the needs type is general needs. Change either the needs type or the letting type." - lettype_not_supported_housing: "This letting type is general needs, but the needs type is supported housing. Change either the needs type or the letting type." - property: uprn: invalid: "UPRN must be 12 digits or less." @@ -486,13 +468,8 @@ en: child_over_19: "Answer cannot be child as you told us person %{person_num} is over 19." housingneeds_a: one_or_two_choices: "You can only select one option or ‘other disabled access needs’ plus ‘wheelchair-accessible housing’, ‘wheelchair access to essential rooms’ or ‘level access housing’." - housingneeds_type: - only_one_option_permitted: "Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected." housingneeds: invalid: "If somebody in the household has disabled access needs, they must have the access needs listed, or other access needs." - no_disabled_needs_conjunction: "No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs." - dont_know_disabled_needs_conjunction: "Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs." - no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together." prevten: non_temp_accommodation: "Answer cannot be non-temporary accommodation as this is a re-let to a tenant who occupied the same property as temporary accommodation." over_25_foster_care: "Answer cannot be a children’s home or foster care as the lead tenant is 26 or older." @@ -507,10 +484,8 @@ en: other_homeless: "Answer cannot be internal transfer as the tenant was considered homeless by their landlord." prevten_invalid: "Answer cannot be internal transfer as the household situation immediately before this letting was %{prevten}." reason_permanently_decanted: "Answer must be internal transfer as the tenant was permanently decanted from another property owned by this landlord." - nominated_by_local_ha_but_la: "The source of the referral cannot be Nominated by local housing authority as your organisation is a local authority." la_general_needs: internal_transfer: "Answer cannot be internal transfer as it’s the same landlord on the tenancy agreement and the household had either a fixed-term or lifetime local authority general needs tenancy immediately before this letting." - prp_referred_by_la: "The source of the referral cannot be referred by local authority housing department for a general needs log." homeless: assessed: internal_transfer: "Answer cannot be 'assessed as homeless' as this tenancy is an internal transfer." @@ -531,8 +506,6 @@ en: retired_female: "Answer cannot be ‘female’ as tenant is under 60 and retired." reason: not_internal_transfer: "Answer cannot be ‘permanently decanted from another property owned by this landlord’ as you told us the source of referral for this tenancy was not an internal transfer." - renewal_reason_needed: 'The reason for leaving must be "End of assured shorthold tenancy - no fault" or "End of fixed term tenancy - no fault" if the letting is a renewal.' - renewal_reason_needed_2024: 'The reason for leaving must be "End of social or private sector tenancy - no fault", "End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)", "End of social or private sector tenancy - evicted due to rent arrears" or "End of social or private sector tenancy - evicted for any other reason".' other_not_settled: "Please give the reason for the tenant leaving their last settled home. This is where they were living before they became homeless, were living in temporary accommodation or sleeping rough." condition_effects: no_choices: "You cannot answer this question as you told us nobody in the household has a physical or mental health condition (or other illness) expected to last 12 months or more." diff --git a/config/locales/validations/lettings/2023/bulk_upload.en.yml b/config/locales/validations/lettings/2023/bulk_upload.en.yml new file mode 100644 index 000000000..e61dbe4a1 --- /dev/null +++ b/config/locales/validations/lettings/2023/bulk_upload.en.yml @@ -0,0 +1,56 @@ +en: + validations: + lettings: + 2023: + bulk_upload: + not_answered: "You must answer %{question}" + invalid_option: "Enter a valid value for %{question}" + invalid_number: "Enter a number for %{question}" + spreadsheet_dupe: "This is a duplicate of a log in your file." + duplicate: "This is a duplicate log." + blank_file: "Template is blank - The template must be filled in for us to create the logs and check if data is correct." + wrong_template: + wrong_template: "Incorrect start dates, please ensure you have used the correct template." + no_headers: "Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})." + wrong_field_numbers_count: "Incorrect number of fields, please ensure you have used the correct template." + over_max_column_count: "Too many columns, please ensure you have used the correct template." + owning_organisation: + not_found: "The owning organisation code is incorrect." + not_stock_owner: "The owning organisation code provided is for an organisation that does not own stock." + not_permitted: "You do not have permission to add logs for this owning organisation." + managing_organisation: + no_relationship: "This managing organisation does not have a relationship with the owning organisation." + not_found: "The managing organisation code is incorrect." + not_answered: "The managing organisation code is incorrect." + assigned_to: + not_found: "User with the specified email could not be found." + organisation_not_related: "User must be related to owning organisation or managing organisation." + startdate: + outside_collection_window: "Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year}." + year_not_two_or_four_digits: "Tenancy start year must be 2 or 4 digits." + housingneeds: + no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together." + dont_know_disabled_needs_conjunction: "Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs." + no_disabled_needs_conjunction: "No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs." + housingneeds_type: + only_one_option_permitted: "Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected." + condition_effects: + no_choices: "You cannot answer this question as you told us nobody in the household has a physical or mental health condition (or other illness) expected to last 12 months or more." + lettype: + needstype_general_needs: "This needs type is general needs, but the letting type is supported housing. Change either the needs type or the letting type." + needstype_supported_housing: "This needs type is supported housing, but the letting type is general needs. Change either the needs type or the letting type." + needstype: + lettype_not_general_needs: "This letting type is supported housing, but the needs type is general needs. Change either the needs type or the letting type." + lettype_not_supported_housing: "This letting type is general needs, but the needs type is supported housing. Change either the needs type or the letting type." + reason: + renewal_reason_needed: "The reason for leaving must be \"End of assured shorthold tenancy - no fault\" or \"End of fixed term tenancy - no fault\" if the letting is a renewal." + referral: + general_needs_prp_referred_by_la: "The source of the referral cannot be referred by local authority housing department for a general needs log." + nominated_by_local_ha_but_la: "The source of the referral cannot be Nominated by local housing authority as your organisation is a local authority." + scheme: + must_relate_to_org: "%{capitalised_location_or_scheme} code must relate to a %{location_or_scheme} that is owned by the owning organisation or managing organisation." + does_not_belong_to_org: "This %{scheme_or_management_group} code does not belong to the owning organisation or managing organisation." + declaration: + missing: "You must show the MHCLG privacy notice to the tenant before you can submit this log." + age: + invalid: "Age of person %{person_num} must be a number or the letter R" \ No newline at end of file diff --git a/config/locales/validations/lettings/2024/bulk_upload.en.yml b/config/locales/validations/lettings/2024/bulk_upload.en.yml new file mode 100644 index 000000000..76985ee32 --- /dev/null +++ b/config/locales/validations/lettings/2024/bulk_upload.en.yml @@ -0,0 +1,56 @@ +en: + validations: + lettings: + 2024: + bulk_upload: + not_answered: "You must answer %{question}" + invalid_option: "Enter a valid value for %{question}" + invalid_number: "Enter a number for %{question}" + spreadsheet_dupe: "This is a duplicate of a log in your file." + duplicate: "This is a duplicate log." + blank_file: "Template is blank - The template must be filled in for us to create the logs and check if data is correct." + wrong_template: + wrong_template: "Incorrect start dates, please ensure you have used the correct template." + no_headers: "Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})." + wrong_field_numbers_count: "Incorrect number of fields, please ensure you have used the correct template." + over_max_column_count: "Too many columns, please ensure you have used the correct template." + owning_organisation: + not_found: "The owning organisation code is incorrect." + not_stock_owner: "The owning organisation code provided is for an organisation that does not own stock." + not_permitted: + not_support: "You do not have permission to add logs for this owning organisation." + support: "This owning organisation is not affiliated with %{org_name}." + managing_organisation: + no_relationship: "This managing organisation does not have a relationship with the owning organisation." + not_found: "The managing organisation code is incorrect." + assigned_to: + not_found: "User with the specified email could not be found." + organisation_not_related: "User must be related to owning organisation or managing organisation." + startdate: + outside_collection_window: "Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year}." + year_not_two_or_four_digits: "Tenancy start year must be 2 or 4 digits." + housingneeds: + no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together." + dont_know_disabled_needs_conjunction: "Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs." + no_disabled_needs_conjunction: "No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs." + housingneeds_type: + only_one_option_permitted: "Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected." + condition_effects: + no_choices: "You cannot answer this question as you told us nobody in the household has a physical or mental health condition (or other illness) expected to last 12 months or more." + reason: + renewal_reason_needed: "The reason for leaving must be \"End of social or private sector tenancy - no fault\", \"End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)\", \"End of social or private sector tenancy - evicted due to rent arrears\" or \"End of social or private sector tenancy - evicted for any other reason\"." + referral: + general_needs_prp_referred_by_la: "The source of the referral cannot be referred by local authority housing department for a general needs log." + nominated_by_local_ha_but_la: "The source of the referral cannot be Nominated by local housing authority as your organisation is a local authority." + scheme: + must_relate_to_org: "This scheme code does not belong to the owning organisation or managing organisation." + location: + must_relate_to_org: "Location code must relate to a location that is owned by the owning organisation or managing organisation." + age: + invalid: "Age of person %{person_num} must be a number or the letter R" + address: + not_found: "We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site." + nationality: + invalid: "Select a valid nationality." + charges: + missing_charges: "Please enter the %{sentence_fragment}. If there is no %{sentence_fragment}, please enter '0'." \ No newline at end of file diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index 314db674d..8161f8a00 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -263,7 +263,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -300,7 +300,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -338,7 +338,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -385,7 +385,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -444,7 +444,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -479,7 +479,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -526,7 +526,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -585,7 +585,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2023.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -686,7 +686,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "cannot be nulled" do parser.valid? - expect(parser.errors[:field_45]).to eq(["You must show the MHCLG privacy notice to the tenant before you can submit this log."]) + expect(parser.errors[:field_45]).to eq([I18n.t("validations.lettings.2023.bulk_upload.declaration.missing")]) end end end @@ -697,8 +697,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "fetches the question's check_answer_label if it exists" do parser.valid? - expect(parser.errors[:field_19]).to eql(["You must answer address line 1."]) - expect(parser.errors[:field_21]).to eql(["You must answer town or city."]) + expect(parser.errors[:field_19]).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "address line 1.")]) + expect(parser.errors[:field_21]).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "town or city.")]) end end end @@ -846,7 +846,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_5]).to be_present - expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type."]) + expect(parser.errors[:field_11]).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "intermediate rent type.")]) end end @@ -857,7 +857,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_5]).to be_present - expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type."]) + expect(parser.errors[:field_11]).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "intermediate rent type.")]) end end @@ -868,7 +868,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_5]).to be_present - expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting."]) + expect(parser.errors[:field_10]).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "is this a London Affordable Rent letting.")]) end end @@ -879,7 +879,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_5]).to be_present - expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting."]) + expect(parser.errors[:field_10]).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "is this a London Affordable Rent letting.")]) end end @@ -888,7 +888,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds error on field_12" do parser.valid? - expect(parser.errors[:field_12]).to eq(["You must answer product name."]) + expect(parser.errors[:field_12]).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "product name.")]) end end @@ -910,8 +910,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "is not permitted" do parser.valid? - expect(parser.errors[:field_4]).to include("This letting type is supported housing, but the needs type is general needs. Change either the needs type or the letting type.") - expect(parser.errors[:field_5]).to include("This needs type is general needs, but the letting type is supported housing. Change either the needs type or the letting type.") + expect(parser.errors[:field_4]).to include(I18n.t("validations.lettings.2023.bulk_upload.needstype.lettype_not_general_needs")) + expect(parser.errors[:field_5]).to include(I18n.t("validations.lettings.2023.bulk_upload.lettype.needstype_general_needs")) end end end @@ -925,8 +925,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "is not permitted" do parser.valid? - expect(parser.errors[:field_4]).to include("This letting type is general needs, but the needs type is supported housing. Change either the needs type or the letting type.") - expect(parser.errors[:field_5]).to include("This needs type is supported housing, but the letting type is general needs. Change either the needs type or the letting type.") + expect(parser.errors[:field_4]).to include(I18n.t("validations.lettings.2023.bulk_upload.needstype.lettype_not_supported_housing")) + expect(parser.errors[:field_5]).to include(I18n.t("validations.lettings.2023.bulk_upload.lettype.needstype_supported_housing")) end end @@ -951,7 +951,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors[:field_16]).to eq(["You must answer scheme code."]) + expect(parser.errors[:field_16]).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "scheme code.")]) expect(parser.errors[:field_17]).to be_blank end end @@ -979,7 +979,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.does_not_belong_to_org", scheme_or_management_group: "scheme")]) expect(parser.errors[:field_17]).to be_blank end end @@ -992,7 +992,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank - expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["You must answer location code."]) + expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "location code.")]) expect(parser.errors[:field_17].count).to eq(1) end end @@ -1005,7 +1005,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank - expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["You must answer management group code."]) + expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "management group code.")]) expect(parser.errors[:field_15].count).to eq(1) end end @@ -1018,7 +1018,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank - expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.must_relate_to_org", capitalised_location_or_scheme: "Location", location_or_scheme: "location")]) end end @@ -1054,7 +1054,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank - expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.must_relate_to_org", capitalised_location_or_scheme: "Location", location_or_scheme: "location")]) end end @@ -1067,7 +1067,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.does_not_belong_to_org", scheme_or_management_group: "scheme")]) expect(parser.errors[:field_17]).to be_blank end end @@ -1093,7 +1093,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors[:field_16]).to include("You must answer scheme name.") + expect(parser.errors[:field_16]).to include(I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "scheme name.")) expect(parser.errors[:field_17]).to be_blank end end @@ -1122,7 +1122,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "returns a setup error" do parser.valid? - expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.does_not_belong_to_org", scheme_or_management_group: "management group")]) expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank end @@ -1135,7 +1135,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["You must answer scheme code."]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "scheme code.")]) expect(parser.errors[:field_17]).to be_blank end end @@ -1147,7 +1147,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.must_relate_to_org", capitalised_location_or_scheme: "Scheme", location_or_scheme: "scheme")]) expect(parser.errors[:field_17]).to be_blank end end @@ -1173,7 +1173,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.must_relate_to_org", capitalised_location_or_scheme: "Scheme", location_or_scheme: "scheme")]) expect(parser.errors[:field_17]).to be_blank end end @@ -1186,7 +1186,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "returns a setup error" do parser.valid? - expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2023.bulk_upload.scheme.does_not_belong_to_org", scheme_or_management_group: "management group")]) expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank end @@ -1212,7 +1212,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "clears the scheme answer" do parser.valid? - expect(parser.errors[:field_15]).to include("You must answer scheme name.") + expect(parser.errors[:field_15]).to include(I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "scheme name.")) expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank end @@ -1255,7 +1255,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "returns an error" do parser.valid? - expect(parser.errors[:field_102]).to include("Enter a valid value for what is the tenant’s main reason for the household leaving their last settled home?") + expect(parser.errors[:field_102]).to include(I18n.t("validations.lettings.2023.bulk_upload.invalid_option", question: "what is the tenant’s main reason for the household leaving their last settled home?")) end end end @@ -1490,7 +1490,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "returns an error" do parser.valid? - expect(parser.errors[:field_9]).to include("Tenancy start year must be 2 or 4 digits.") + expect(parser.errors[:field_9]).to include(I18n.t("validations.lettings.2023.bulk_upload.startdate.year_not_two_or_four_digits")) end end @@ -1537,7 +1537,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "is not permitted as setup error" do parser.valid? - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "owning organisation.")]) end it "blocks log creation" do @@ -1553,7 +1553,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code is incorrect.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.lettings.2023.bulk_upload.owning_organisation.not_found")) end it "blocks log creation" do @@ -1571,7 +1571,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.lettings.2023.bulk_upload.owning_organisation.not_stock_owner")) end it "blocks log creation" do @@ -1589,7 +1589,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("You do not have permission to add logs for this owning organisation.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.lettings.2023.bulk_upload.owning_organisation.not_permitted")) end it "blocks log creation" do @@ -1652,7 +1652,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.lettings.2023.bulk_upload.managing_organisation.not_answered")) end it "blocks log creation" do @@ -1668,7 +1668,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.lettings.2023.bulk_upload.managing_organisation.not_found")) end it "blocks log creation" do @@ -1686,7 +1686,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This managing organisation does not have a relationship with the owning organisation.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.lettings.2023.bulk_upload.managing_organisation.no_relationship")) end it "blocks log creation" do @@ -1702,7 +1702,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "is reported as a setup error" do parser.valid? - expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql(["You must answer needs type."]) + expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "needs type.")]) end end end @@ -1713,7 +1713,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "has setup errors on the field" do parser.valid? - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eql(["You must answer property renewal."]) + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "property renewal.")]) end end @@ -1722,7 +1722,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds a setup error" do parser.valid? - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include("Enter a valid value for is this letting a renewal?") + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include(I18n.t("validations.lettings.2023.bulk_upload.invalid_option", question: "is this letting a renewal?")) end end end @@ -1743,9 +1743,9 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds appropriate errors" do parser.valid? - expect(parser.errors[:field_18]).to eql(["You must answer UPRN."]) - expect(parser.errors[:field_19]).to eql(["You must answer address line 1."]) - expect(parser.errors[:field_21]).to eql(["You must answer town or city."]) + expect(parser.errors[:field_18]).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "UPRN.")]) + expect(parser.errors[:field_19]).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "address line 1.")]) + expect(parser.errors[:field_21]).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "town or city.")]) end end @@ -1821,7 +1821,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "populates with correct error message" do parser.valid? - expect(parser.errors[:field_30]).to eql(["You must answer type of building."]) + expect(parser.errors[:field_30]).to eql([I18n.t("validations.lettings.2023.bulk_upload.not_answered", question: "type of building.")]) end end end @@ -2170,7 +2170,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error" do parser.valid? - expect(parser.errors[:field_116]).to include("Enter a valid value for was the letting made under the Choice-Based Lettings (CBL)?") + expect(parser.errors[:field_116]).to include(I18n.t("validations.lettings.2023.bulk_upload.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?")) end end end @@ -2197,7 +2197,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error" do parser.valid? - expect(parser.errors[:field_118]).to include("Enter a valid value for was the letting made under the Common Housing Register (CHR)?") + expect(parser.errors[:field_118]).to include(I18n.t("validations.lettings.2023.bulk_upload.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?")) end end end @@ -2224,7 +2224,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error" do parser.valid? - expect(parser.errors[:field_117]).to include("Enter a valid value for was the letting made under the Common Allocation Policy (CAP)?") + expect(parser.errors[:field_117]).to include(I18n.t("validations.lettings.2023.bulk_upload.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?")) end end end @@ -2736,8 +2736,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "sets error on housingneeds a and b" do parser.valid? - expect(parser.errors[:field_83]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") - expect(parser.errors[:field_84]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") + expect(parser.errors[:field_83]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_84]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds_type.only_one_option_permitted")) expect(parser.errors[:field_85]).to be_blank end end @@ -2747,8 +2747,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "sets error on housingneeds a and c" do parser.valid? - expect(parser.errors[:field_83]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") - expect(parser.errors[:field_85]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") + expect(parser.errors[:field_83]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_85]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds_type.only_one_option_permitted")) expect(parser.errors[:field_84]).to be_blank end end @@ -2758,8 +2758,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "sets error on housingneeds b and c" do parser.valid? - expect(parser.errors[:field_84]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") - expect(parser.errors[:field_85]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") + expect(parser.errors[:field_84]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_85]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds_type.only_one_option_permitted")) expect(parser.errors[:field_83]).to be_blank end end @@ -2769,8 +2769,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "sets error on housingneeds a and g" do parser.valid? - expect(parser.errors[:field_87]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") - expect(parser.errors[:field_83]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") + expect(parser.errors[:field_87]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds.no_disabled_needs_conjunction")) + expect(parser.errors[:field_83]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds.no_disabled_needs_conjunction")) expect(parser.errors[:field_84]).to be_blank expect(parser.errors[:field_85]).to be_blank end @@ -2793,8 +2793,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "sets error on housingneeds a and h" do parser.valid? - expect(parser.errors[:field_88]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") - expect(parser.errors[:field_83]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") + expect(parser.errors[:field_88]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) + expect(parser.errors[:field_83]).to include(I18n.t("validations.lettings.2023.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) expect(parser.errors[:field_84]).to be_blank expect(parser.errors[:field_85]).to be_blank end diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index d82effa0b..e33458eb4 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -283,7 +283,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -339,7 +339,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -381,7 +381,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -432,7 +432,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -492,7 +492,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -527,7 +527,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -574,7 +574,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -634,7 +634,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.lettings.2024.bulk_upload.duplicate") [ :field_1, # owning_organisation @@ -770,7 +770,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "fetches the question's check_answer_label if it exists" do parser.valid? - expect(parser.errors[:field_43]).to eql(["You must answer lead tenant’s gender identity."]) + expect(parser.errors[:field_43]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "lead tenant’s gender identity.")]) end end @@ -779,7 +779,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "only has one error added to the field" do parser.valid? - expect(parser.errors[:field_112]).to eql(["You must answer was the letting made under the Choice-Based Lettings (CBL)?"]) + expect(parser.errors[:field_112]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?")]) end end @@ -789,7 +789,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "does not add an additional error" do parser.valid? expect(parser.errors[:field_116].length).to eq(1) - expect(parser.errors[:field_116]).to include(match "Enter a valid value for") + expect(parser.errors[:field_116]).to include(match I18n.t("validations.lettings.2024.bulk_upload.invalid_option", question: "")) end end end @@ -833,7 +833,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "is not permitted" do parser.valid? expect(parser.errors[:field_3]).to be_present - expect(parser.errors[:field_3]).to include("You must answer what is the CORE username of the account this letting log should be assigned to?") + expect(parser.errors[:field_3]).to include(I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "what is the CORE username of the account this letting log should be assigned to?")) end it "blocks log creation" do @@ -915,8 +915,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "cannot be nulled" do parser.valid? - expect(parser.errors[:field_5]).to eq(["You must answer scheme code."]) - expect(parser.errors[:field_6]).to eq(["You must answer location code."]) + expect(parser.errors[:field_5]).to eq([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "scheme code.")]) + expect(parser.errors[:field_6]).to eq([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "location code.")]) end end @@ -942,7 +942,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S123", field_6: location.id } } it "returns a setup error" do - expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2024.bulk_upload.scheme.must_relate_to_org")]) expect(parser.errors[:field_6]).to be_blank end end @@ -952,7 +952,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["You must answer location code."]) + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "location code.")]) expect(parser.errors[:field_6].count).to eq(1) end end @@ -962,7 +962,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2024.bulk_upload.location.must_relate_to_org")]) end end @@ -991,7 +991,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2024.bulk_upload.location.must_relate_to_org")]) end end @@ -1001,7 +1001,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_11: "2", field_5: "S#{other_scheme.id}", field_6: other_location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "returns a setup error" do - expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) + expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq([I18n.t("validations.lettings.2024.bulk_upload.scheme.must_relate_to_org")]) expect(parser.errors[:field_6]).to be_blank end end @@ -1081,7 +1081,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "is not permitted" do parser.valid? - expect(parser.errors[:field_98]).to include('The reason for leaving must be "End of social or private sector tenancy - no fault", "End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)", "End of social or private sector tenancy - evicted due to rent arrears" or "End of social or private sector tenancy - evicted for any other reason".') + expect(parser.errors[:field_98]).to include(I18n.t("validations.lettings.2024.bulk_upload.reason.renewal_reason_needed")) end end end @@ -1091,7 +1091,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "returns an error" do parser.valid? - expect(parser.errors[:field_98]).to include("Enter a valid value for what is the tenant’s main reason for the household leaving their last settled home?") + expect(parser.errors[:field_98]).to include(I18n.t("validations.lettings.2024.bulk_upload.invalid_option", question: "what is the tenant’s main reason for the household leaving their last settled home?")) end end end @@ -1317,7 +1317,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "returns an error" do parser.valid? - expect(parser.errors[:field_10]).to include("Tenancy start year must be 2 or 4 digits.") + expect(parser.errors[:field_10]).to include(I18n.t("validations.lettings.2024.bulk_upload.startdate.year_not_two_or_four_digits")) end end @@ -1368,7 +1368,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "is not permitted as setup error" do parser.valid? - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "owning organisation.")]) end it "blocks log creation" do @@ -1385,7 +1385,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code is incorrect.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.lettings.2024.bulk_upload.owning_organisation.not_found")) end it "blocks log creation" do @@ -1404,7 +1404,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.lettings.2024.bulk_upload.owning_organisation.not_stock_owner")) end it "blocks log creation" do @@ -1423,7 +1423,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("You do not have permission to add logs for this owning organisation.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.lettings.2024.bulk_upload.owning_organisation.not_permitted.not_support")) end it "blocks log creation" do @@ -1492,7 +1492,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do parser = described_class.new(attributes) parser.valid? expect(parser).to be_block_log_creation - expect(parser.errors[:field_1]).to include("You do not have permission to add logs for this owning organisation.") + expect(parser.errors[:field_1]).to include(I18n.t("validations.lettings.2024.bulk_upload.owning_organisation.not_permitted.not_support")) end end @@ -1510,7 +1510,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "does not block log creation and does not add an error to field_1" do parser = described_class.new(attributes) parser.valid? - expect(parser.errors[:field_1]).not_to include("You do not have permission to add logs for this owning organisation.") + expect(parser.errors[:field_1]).not_to include(I18n.t("validations.lettings.2024.bulk_upload.owning_organisation.not_permitted")) end end end @@ -1524,7 +1524,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer managing organisation.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "managing organisation.")) end it "blocks log creation" do @@ -1541,7 +1541,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.lettings.2024.bulk_upload.managing_organisation.not_found")) end it "blocks log creation" do @@ -1560,7 +1560,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This managing organisation does not have a relationship with the owning organisation.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.lettings.2024.bulk_upload.managing_organisation.no_relationship")) end it "blocks log creation" do @@ -1576,7 +1576,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "is reported as a setup error" do parser.valid? - expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql(["You must answer needs type."]) + expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "needs type.")]) end end end @@ -1587,7 +1587,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "has setup errors on the field" do parser.valid? - expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to eql(["You must answer property renewal."]) + expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "property renewal.")]) end end @@ -1596,7 +1596,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds a setup error" do parser.valid? - expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to include("Enter a valid value for is this letting a renewal?") + expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to include(I18n.t("validations.lettings.2024.bulk_upload.invalid_option", question: "is this letting a renewal?")) end end end @@ -1627,10 +1627,10 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds errors to missing key address fields" do parser.valid? - expect(parser.errors[:field_17]).to eql(["You must answer address line 1."]) - expect(parser.errors[:field_19]).to eql(["You must answer town or city."]) - expect(parser.errors[:field_21]).to eql(["You must answer part 1 of postcode."]) - expect(parser.errors[:field_22]).to eql(["You must answer part 2 of postcode."]) + expect(parser.errors[:field_17]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "address line 1.")]) + expect(parser.errors[:field_19]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "town or city.")]) + expect(parser.errors[:field_21]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "part 1 of postcode.")]) + expect(parser.errors[:field_22]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "part 2 of postcode.")]) end end @@ -1658,11 +1658,11 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds appropriate errors to UPRN and key address fields" do parser.valid? - expect(parser.errors[:field_16]).to eql(["You must answer UPRN."]) - expect(parser.errors[:field_17]).to eql(["You must answer address line 1."]) - expect(parser.errors[:field_19]).to eql(["You must answer town or city."]) - expect(parser.errors[:field_21]).to eql(["You must answer part 1 of postcode."]) - expect(parser.errors[:field_22]).to eql(["You must answer part 2 of postcode."]) + expect(parser.errors[:field_16]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "UPRN.")]) + expect(parser.errors[:field_17]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "address line 1.")]) + expect(parser.errors[:field_19]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "town or city.")]) + expect(parser.errors[:field_21]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "part 1 of postcode.")]) + expect(parser.errors[:field_22]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "part 2 of postcode.")]) end end @@ -1671,8 +1671,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds errors to UPRN and the missing key address field" do parser.valid? - expect(parser.errors[:field_16]).to eql(["You must answer UPRN."]) - expect(parser.errors[:field_17]).to eql(["You must answer address line 1."]) + expect(parser.errors[:field_16]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "UPRN.")]) + expect(parser.errors[:field_17]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "address line 1.")]) expect(parser.errors[:field_19]).to be_empty expect(parser.errors[:field_21]).to be_empty expect(parser.errors[:field_22]).to be_empty @@ -1706,7 +1706,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do parser.valid? expect(parser.errors[:field_16]).to be_empty %i[field_17 field_18 field_19 field_20 field_21 field_22].each do |field| - expect(parser.errors[field]).to eql(["We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site."]) + expect(parser.errors[field]).to eql([I18n.t("validations.lettings.2024.bulk_upload.address.not_found")]) end end end @@ -1721,7 +1721,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do parser.valid? expect(parser.errors[:field_16]).to be_empty %i[field_17 field_18 field_19 field_20 field_21 field_22].each do |field| - expect(parser.errors[field]).to eql(["We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site."]) + expect(parser.errors[field]).to eql([I18n.t("validations.lettings.2024.bulk_upload.address.not_found")]) end end end @@ -1765,7 +1765,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "populates with correct error message" do parser.valid? - expect(parser.errors[:field_27]).to eql(["You must answer type of building."]) + expect(parser.errors[:field_27]).to eql([I18n.t("validations.lettings.2024.bulk_upload.not_answered", question: "type of building.")]) end end end @@ -1864,7 +1864,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to field_45" do parser.valid? - expect(parser.errors["field_45"]).to include("Select a valid nationality.") + expect(parser.errors["field_45"]).to include(I18n.t("validations.lettings.2024.bulk_upload.nationality.invalid")) end end end @@ -2185,7 +2185,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error" do parser.valid? - expect(parser.errors[:field_112]).to include("Enter a valid value for was the letting made under the Choice-Based Lettings (CBL)?") + expect(parser.errors[:field_112]).to include(I18n.t("validations.lettings.2024.bulk_upload.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?")) end end end @@ -2212,7 +2212,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error" do parser.valid? - expect(parser.errors[:field_114]).to include("Enter a valid value for was the letting made under the Common Housing Register (CHR)?") + expect(parser.errors[:field_114]).to include(I18n.t("validations.lettings.2024.bulk_upload.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?")) end end end @@ -2239,7 +2239,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error" do parser.valid? - expect(parser.errors[:field_113]).to include("Enter a valid value for was the letting made under the Common Allocation Policy (CAP)?") + expect(parser.errors[:field_113]).to include(I18n.t("validations.lettings.2024.bulk_upload.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?")) end end end @@ -2266,7 +2266,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error" do parser.valid? - expect(parser.errors[:field_115]).to include("Enter a valid value for was the letting made under the Accessible Register?") + expect(parser.errors[:field_115]).to include(I18n.t("validations.lettings.2024.bulk_upload.invalid_option", question: "was the letting made under the Accessible Register?")) end end end @@ -2603,10 +2603,10 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all missing charges" do parser.valid? - expect(parser.errors[:field_125]).to eql(["Please enter the basic rent. If there is no basic rent, please enter '0'."]) - expect(parser.errors[:field_126]).to eql(["Please enter the service charge. If there is no service charge, please enter '0'."]) - expect(parser.errors[:field_127]).to eql(["Please enter the personal service charge. If there is no personal service charge, please enter '0'."]) - expect(parser.errors[:field_128]).to eql(["Please enter the basic rent. If there is no basic rent, please enter '0'.", "Please enter the service charge. If there is no service charge, please enter '0'.", "Please enter the personal service charge. If there is no personal service charge, please enter '0'."]) + expect(parser.errors[:field_125]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "basic rent")]) + expect(parser.errors[:field_126]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "service charge")]) + expect(parser.errors[:field_127]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "personal service charge")]) + expect(parser.errors[:field_128]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "basic rent"), I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "service charge"), I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "personal service charge")]) end end end @@ -2627,10 +2627,10 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all charges" do parser.valid? - expect(parser.errors[:field_125]).to eql(["Please enter the support charge. If there is no support charge, please enter '0'."]) - expect(parser.errors[:field_126]).to eql(["Please enter the support charge. If there is no support charge, please enter '0'."]) - expect(parser.errors[:field_127]).to eql(["Please enter the support charge. If there is no support charge, please enter '0'."]) - expect(parser.errors[:field_128]).to eql(["Please enter the support charge. If there is no support charge, please enter '0'."]) + expect(parser.errors[:field_125]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "support charge")]) + expect(parser.errors[:field_126]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "support charge")]) + expect(parser.errors[:field_127]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "support charge")]) + expect(parser.errors[:field_128]).to eql([I18n.t("validations.lettings.2024.bulk_upload.charges.missing_charges", sentence_fragment: "support charge")]) end end end @@ -2857,8 +2857,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "sets error on housingneeds a and b" do parser.valid? - expect(parser.errors[:field_79]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") - expect(parser.errors[:field_80]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") + expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_80]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds_type.only_one_option_permitted")) expect(parser.errors[:field_81]).to be_blank end end @@ -2868,8 +2868,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "sets error on housingneeds a and c" do parser.valid? - expect(parser.errors[:field_79]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") - expect(parser.errors[:field_81]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") + expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_81]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds_type.only_one_option_permitted")) expect(parser.errors[:field_80]).to be_blank end end @@ -2879,8 +2879,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "sets error on housingneeds b and c" do parser.valid? - expect(parser.errors[:field_80]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") - expect(parser.errors[:field_81]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.") + expect(parser.errors[:field_80]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_81]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds_type.only_one_option_permitted")) expect(parser.errors[:field_79]).to be_blank end end @@ -2890,8 +2890,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "sets error on housingneeds a and g" do parser.valid? - expect(parser.errors[:field_83]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") - expect(parser.errors[:field_79]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") + expect(parser.errors[:field_83]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds.no_disabled_needs_conjunction")) + expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds.no_disabled_needs_conjunction")) expect(parser.errors[:field_80]).to be_blank expect(parser.errors[:field_81]).to be_blank end @@ -2914,8 +2914,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "sets error on housingneeds a and h" do parser.valid? - expect(parser.errors[:field_84]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") - expect(parser.errors[:field_79]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.") + expect(parser.errors[:field_84]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) + expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2024.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) expect(parser.errors[:field_80]).to be_blank expect(parser.errors[:field_81]).to be_blank end From dd9bc7b191de71c40d696bef520c1dc1b4623686 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:43:17 +0000 Subject: [PATCH 06/27] CLDC-3669 Extract bulk upload validations (#2719) --- app/services/bulk_upload/processor.rb | 6 +- app/services/bulk_upload/sales/validator.rb | 10 +- .../bulk_upload/sales/year2023/row_parser.rb | 77 ++++++++-------- .../bulk_upload/sales/year2024/row_parser.rb | 90 +++++++++--------- config/locales/en.yml | 8 -- .../validations/sales/2023/bulk_upload.en.yml | 29 ++++++ .../validations/sales/2024/bulk_upload.en.yml | 44 +++++++++ .../bulk_upload/sales/validator_spec.rb | 6 +- .../sales/year2023/row_parser_spec.rb | 20 ++-- .../sales/year2024/row_parser_spec.rb | 92 +++++++++---------- 10 files changed, 225 insertions(+), 157 deletions(-) create mode 100644 config/locales/validations/sales/2023/bulk_upload.en.yml create mode 100644 config/locales/validations/sales/2024/bulk_upload.en.yml diff --git a/app/services/bulk_upload/processor.rb b/app/services/bulk_upload/processor.rb index 3a6ef4a33..38f67ede4 100644 --- a/app/services/bulk_upload/processor.rb +++ b/app/services/bulk_upload/processor.rb @@ -6,7 +6,8 @@ class BulkUpload::Processor [ I18n.t("validations.lettings.#{current_collection_start_year}.bulk_upload.blank_file"), I18n.t("validations.lettings.#{previous_collection_start_year}.bulk_upload.blank_file"), - I18n.t("activemodel.errors.models.bulk_upload/sales/validator.attributes.base.blank_file"), + I18n.t("validations.sales.#{current_collection_start_year}.bulk_upload.blank_file"), + I18n.t("validations.sales.#{previous_collection_start_year}.bulk_upload.blank_file"), ].freeze end @@ -14,7 +15,8 @@ class BulkUpload::Processor [ *I18n.t("validations.lettings.#{current_collection_start_year}.bulk_upload.wrong_template", default: {}).values, *I18n.t("validations.lettings.#{previous_collection_start_year}.bulk_upload.wrong_template", default: {}).values, - *I18n.t("activemodel.errors.models.bulk_upload/sales/validator.attributes.base", default: {}).values, + *I18n.t("validations.sales.#{current_collection_start_year}.bulk_upload.wrong_template", default: {}).values, + *I18n.t("validations.sales.#{previous_collection_start_year}.bulk_upload.wrong_template", default: {}).values, ].freeze end diff --git a/app/services/bulk_upload/sales/validator.rb b/app/services/bulk_upload/sales/validator.rb index a473a6461..76fb6f1ae 100644 --- a/app/services/bulk_upload/sales/validator.rb +++ b/app/services/bulk_upload/sales/validator.rb @@ -153,7 +153,7 @@ private def validate_file_not_empty if File.size(path).zero? || csv_parser.body_rows.flatten.compact.empty? - errors.add(:base, :blank_file) + errors.add(:base, I18n.t("validations.sales.#{@bulk_upload.year}.bulk_upload.blank_file")) halt_validations! end @@ -164,20 +164,20 @@ private column_count = rows.map(&:size).max - errors.add(:base, :over_max_column_count) if column_count > csv_parser.class::MAX_COLUMNS + errors.add(:base, I18n.t("validations.sales.#{@bulk_upload.year}.bulk_upload.wrong_template.over_max_column_count")) if column_count > csv_parser.class::MAX_COLUMNS end def validate_correct_template return if halt_validations? - errors.add(:base, :wrong_template) if csv_parser.wrong_template_for_year? + errors.add(:base, I18n.t("validations.sales.#{@bulk_upload.year}.bulk_upload.wrong_template.wrong_template")) if csv_parser.wrong_template_for_year? end def validate_missing_required_headers return if halt_validations? if csv_parser.missing_required_headers? - errors.add :base, I18n.t("activemodel.errors.models.bulk_upload/sales/validator.attributes.base.no_headers", guidance_link: bulk_upload_sales_log_url(id: "guidance", form: { year: bulk_upload.year }, host: ENV["APP_HOST"], anchor: "using-the-bulk-upload-template")) + errors.add :base, I18n.t("validations.sales.#{@bulk_upload.year}.bulk_upload.wrong_template.no_headers", guidance_link: bulk_upload_sales_log_url(id: "guidance", form: { year: bulk_upload.year }, host: ENV["APP_HOST"], anchor: "using-the-bulk-upload-template")) end end @@ -185,7 +185,7 @@ private return if halt_validations? unless csv_parser.correct_field_count? - errors.add(:base, :wrong_field_numbers_count) + errors.add(:base, I18n.t("validations.sales.#{@bulk_upload.year}.bulk_upload.wrong_template.wrong_field_numbers_count")) halt_validations! end end diff --git a/app/services/bulk_upload/sales/year2023/row_parser.rb b/app/services/bulk_upload/sales/year2023/row_parser.rb index d87c94dce..39fb41d6b 100644 --- a/app/services/bulk_upload/sales/year2023/row_parser.rb +++ b/app/services/bulk_upload/sales/year2023/row_parser.rb @@ -155,6 +155,8 @@ class BulkUpload::Sales::Year2023::RowParser field_135: "What are the total monthly leasehold charges for the property?", }.freeze + ERROR_BASE_KEY = "validations.sales.2023.bulk_upload".freeze + attribute :bulk_upload attribute :block_log_creation, :boolean, default: -> { false } @@ -311,32 +313,32 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_3, presence: { - message: I18n.t("validations.not_answered", question: "sale completion date (day)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "sale completion date (day)."), category: :setup, }, on: :after_log validates :field_4, presence: { - message: I18n.t("validations.not_answered", question: "sale completion date (month)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "sale completion date (month)."), category: :setup, }, on: :after_log validates :field_5, presence: { - message: I18n.t("validations.not_answered", question: "sale completion date (year)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "sale completion date (year)."), category: :setup, }, format: { with: /\A(\d{2}|\d{4})\z/, - message: I18n.t("validations.setup.saledate.year_not_two_or_four_digits"), + message: I18n.t("#{ERROR_BASE_KEY}.saledate.year_not_two_or_four_digits"), category: :setup, if: proc { field_5.present? }, }, on: :after_log validates :field_7, presence: { - message: I18n.t("validations.not_answered", question: "purchase made under ownership scheme."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "purchase made under ownership scheme."), category: :setup, }, on: :after_log @@ -352,7 +354,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_8, presence: { - message: I18n.t("validations.not_answered", question: "type of shared ownership sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of shared ownership sale."), category: :setup, if: :shared_ownership?, }, @@ -369,7 +371,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_9, presence: { - message: I18n.t("validations.not_answered", question: "type of discounted ownership sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of discounted ownership sale."), category: :setup, if: :discounted_ownership?, }, @@ -386,7 +388,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_10, presence: { - message: I18n.t("validations.not_answered", question: "type of outright sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of outright sale."), category: :setup, if: :outright_sale?, }, @@ -394,7 +396,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_11, presence: { - message: I18n.t("validations.not_answered", question: "type of outright sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of outright sale."), category: :setup, if: proc { field_10 == 12 }, }, @@ -411,7 +413,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_12, presence: { - message: I18n.t("validations.not_answered", question: "company buyer."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "company buyer."), category: :setup, if: :outright_sale?, }, @@ -428,7 +430,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_13, presence: { - message: I18n.t("validations.not_answered", question: "buyers living in property."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "buyers living in property."), category: :setup, if: :outright_sale?, }, @@ -436,7 +438,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_14, presence: { - message: I18n.t("validations.not_answered", question: "joint purchase."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "joint purchase."), category: :setup, if: :joint_purchase_asked?, }, @@ -444,7 +446,7 @@ class BulkUpload::Sales::Year2023::RowParser validates :field_15, presence: { - message: I18n.t("validations.not_answered", question: "more than 2 joint buyers."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "more than 2 joint buyers."), category: :setup, if: :joint_purchase?, }, @@ -560,7 +562,7 @@ class BulkUpload::Sales::Year2023::RowParser def add_duplicate_found_in_spreadsheet_errors spreadsheet_duplicate_hash.each_key do |field| - errors.add(field, :spreadsheet_dupe, category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup) end end @@ -568,7 +570,7 @@ private def validate_data_protection_answered unless field_29 == 1 - errors.add(:field_29, I18n.t("validations.not_answered", question: "Data Protection question."), category: :setup) + errors.add(:field_29, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "Data Protection question."), category: :setup) end end @@ -600,18 +602,19 @@ private def validate_uprn_exists_if_any_key_address_fields_are_blank if field_19.blank? && (field_20.blank? || field_22.blank?) - errors.add(:field_19, I18n.t("validations.not_answered", question: "UPRN."), category: :not_answered) + # I18n.t("#{ERROR_BASE_KEY}.not_answered", question: question.error_display_label) + errors.add(:field_19, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "UPRN."), category: :not_answered) end end def validate_address_fields if field_19.blank? || log.errors.attribute_names.include?(:uprn) if field_20.blank? - errors.add(:field_20, I18n.t("validations.not_answered", question: "address line 1."), category: :not_answered) + errors.add(:field_20, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "address line 1."), category: :not_answered) end if field_22.blank? - errors.add(:field_22, I18n.t("validations.not_answered", question: "town or city."), category: :not_answered) + errors.add(:field_22, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "town or city."), category: :not_answered) end end end @@ -1162,7 +1165,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_answered"), category: :setup) end end end @@ -1172,7 +1175,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_found"), category: :setup) end end end @@ -1182,7 +1185,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_stock_owner"), category: :setup) end end end @@ -1192,7 +1195,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_permitted"), category: :setup) end end end @@ -1201,7 +1204,7 @@ private return if field_2.blank? unless assigned_to - errors.add(:field_2, "User with the specified email could not be found.") + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.assigned_to.not_found")) end end @@ -1211,7 +1214,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_2, "User must be related to owning organisation or managing organisation.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.assigned_to.organisation_not_related"), category: :setup) end def managing_organisation @@ -1225,7 +1228,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This user belongs to an organisation that does not have a relationship with the owning organisation.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.assigned_to.managing_organisation_not_related"), category: :setup) end end end @@ -1246,13 +1249,13 @@ private if setup_question?(question) fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.not_answered", question: question.error_display_label), category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: question.error_display_label), category: :setup) end end else fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.not_answered", question: question.error_display_label), category: :not_answered) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: question.error_display_label), category: :not_answered) end end end @@ -1272,15 +1275,15 @@ private if setup_question?(question) fields.each do |field| - if errors[field].none? - block_log_creation! - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) - end + next unless errors[field].none? + + block_log_creation! + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) end else fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field]))) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field]))) end end end @@ -1292,15 +1295,15 @@ private return if errors.key?(:field_3) || errors.key?(:field_4) || errors.key?(:field_5) unless bulk_upload.form.valid_start_date_for_form?(saledate) - errors.add(:field_3, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_4, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_5, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_3, I18n.t("#{ERROR_BASE_KEY}.saledate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_4, I18n.t("#{ERROR_BASE_KEY}.saledate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_5, I18n.t("#{ERROR_BASE_KEY}.saledate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) end end def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log." + error_message = I18n.t("#{ERROR_BASE_KEY}.duplicate") errors.add(:field_1, error_message) # Owning org errors.add(:field_3, error_message) # Sale completion date @@ -1335,7 +1338,7 @@ private def validate_buyer1_economic_status if field_35 == 9 - errors.add(:field_35, "Buyer 1 cannot be a child under 16.") + errors.add(:field_35, I18n.t("#{ERROR_BASE_KEY}.ecstat1.child_under_16")) end end end diff --git a/app/services/bulk_upload/sales/year2024/row_parser.rb b/app/services/bulk_upload/sales/year2024/row_parser.rb index 7b72eef5c..fdef65aec 100644 --- a/app/services/bulk_upload/sales/year2024/row_parser.rb +++ b/app/services/bulk_upload/sales/year2024/row_parser.rb @@ -151,6 +151,8 @@ class BulkUpload::Sales::Year2024::RowParser field_131: "What are the total monthly leasehold charges for the property?", }.freeze + ERROR_BASE_KEY = "validations.sales.2024.bulk_upload".freeze + attribute :bulk_upload attribute :block_log_creation, :boolean, default: -> { false } @@ -303,32 +305,32 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_4, presence: { - message: I18n.t("validations.not_answered", question: "sale completion date (day)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "sale completion date (day)."), category: :setup, }, on: :after_log validates :field_5, presence: { - message: I18n.t("validations.not_answered", question: "sale completion date (month)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "sale completion date (month)."), category: :setup, }, on: :after_log validates :field_6, presence: { - message: I18n.t("validations.not_answered", question: "sale completion date (year)."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "sale completion date (year)."), category: :setup, }, format: { with: /\A(\d{2}|\d{4})\z/, - message: I18n.t("validations.setup.saledate.year_not_two_or_four_digits"), + message: I18n.t("#{ERROR_BASE_KEY}.saledate.year_not_two_or_four_digits"), category: :setup, if: proc { field_6.present? }, }, on: :after_log validates :field_8, presence: { - message: I18n.t("validations.not_answered", question: "purchase made under ownership scheme."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "purchase made under ownership scheme."), category: :setup, }, on: :after_log @@ -344,7 +346,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_9, presence: { - message: I18n.t("validations.not_answered", question: "type of shared ownership sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of shared ownership sale."), category: :setup, if: :shared_ownership?, }, @@ -361,7 +363,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_10, presence: { - message: I18n.t("validations.not_answered", question: "type of discounted ownership sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of discounted ownership sale."), category: :setup, if: :discounted_ownership?, }, @@ -369,7 +371,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_116, numericality: { - message: I18n.t("validations.numeric.within_range", field: "Percentage discount", min: "0%", max: "70%"), + message: I18n.t("#{ERROR_BASE_KEY}.numeric.within_range", field: "Percentage discount", min: "0%", max: "70%"), greater_than_or_equal_to: 0, less_than_or_equal_to: 70, if: :discounted_ownership?, @@ -387,7 +389,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_11, presence: { - message: I18n.t("validations.not_answered", question: "type of outright sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of outright sale."), category: :setup, if: :outright_sale?, }, @@ -395,7 +397,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_12, presence: { - message: I18n.t("validations.not_answered", question: "type of outright sale."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "type of outright sale."), category: :setup, if: proc { field_11 == 12 }, }, @@ -412,7 +414,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_13, presence: { - message: I18n.t("validations.not_answered", question: "company buyer."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "company buyer."), category: :setup, if: :outright_sale?, }, @@ -429,7 +431,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_14, presence: { - message: I18n.t("validations.not_answered", question: "buyers living in property."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "buyers living in property."), category: :setup, if: :outright_sale?, }, @@ -437,7 +439,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_15, presence: { - message: I18n.t("validations.not_answered", question: "joint purchase."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "joint purchase."), category: :setup, if: :joint_purchase_asked?, }, @@ -445,7 +447,7 @@ class BulkUpload::Sales::Year2024::RowParser validates :field_16, presence: { - message: I18n.t("validations.not_answered", question: "more than 2 joint buyers."), + message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "more than 2 joint buyers."), category: :setup, if: :joint_purchase?, }, @@ -569,7 +571,7 @@ class BulkUpload::Sales::Year2024::RowParser def add_duplicate_found_in_spreadsheet_errors spreadsheet_duplicate_hash.each_key do |field| - errors.add(field, :spreadsheet_dupe, category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup) end end @@ -603,14 +605,14 @@ private def validate_uprn_exists_if_any_key_address_fields_are_blank if field_22.blank? && !key_address_fields_provided? - errors.add(:field_22, I18n.t("validations.not_answered", question: "UPRN.")) + errors.add(:field_22, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "UPRN.")) end end def validate_address_option_found if log.uprn.nil? && field_22.blank? && key_address_fields_provided? %i[field_23 field_24 field_25 field_26 field_27 field_28].each do |field| - errors.add(field, I18n.t("validations.no_address_found")) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.address.not_found")) end end end @@ -622,19 +624,19 @@ private def validate_address_fields if field_22.blank? || log.errors.attribute_names.include?(:uprn) if field_23.blank? - errors.add(:field_23, I18n.t("validations.not_answered", question: "address line 1.")) + errors.add(:field_23, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "address line 1.")) end if field_25.blank? - errors.add(:field_25, I18n.t("validations.not_answered", question: "town or city.")) + errors.add(:field_25, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "town or city.")) end if field_27.blank? - errors.add(:field_27, I18n.t("validations.not_answered", question: "part 1 of postcode.")) + errors.add(:field_27, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "part 1 of postcode.")) end if field_28.blank? - errors.add(:field_28, I18n.t("validations.not_answered", question: "part 2 of postcode.")) + errors.add(:field_28, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "part 2 of postcode.")) end end end @@ -1281,7 +1283,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, I18n.t("validations.not_answered", question: "owning organisation."), category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "owning organisation."), category: :setup) end end end @@ -1291,7 +1293,7 @@ private block_log_creation! if field_1.present? && errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_found"), category: :setup) end end end @@ -1301,7 +1303,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_stock_owner"), category: :setup) end end end @@ -1315,9 +1317,9 @@ private return if errors[:field_1].present? if bulk_upload.user.support? - errors.add(:field_1, "This owning organisation is not affiliated with #{bulk_upload_organisation.name}.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_permitted.support", name: bulk_upload_organisation.name), category: :setup) else - errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) + errors.add(:field_1, I18n.t("#{ERROR_BASE_KEY}.owning_organisation.not_permitted.not_support"), category: :setup) end end @@ -1325,13 +1327,13 @@ private return if field_3.blank? unless assigned_to - errors.add(:field_3, "User with the specified email could not be found.") + errors.add(:field_3, I18n.t("#{ERROR_BASE_KEY}.assigned_to.not_found")) end end def validate_assigned_to_when_support if field_3.blank? && bulk_upload.user.support? - errors.add(:field_3, category: :setup, message: I18n.t("validations.not_answered", question: "what is the CORE username of the account this sales log should be assigned to?")) + errors.add(:field_3, category: :setup, message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "what is the CORE username of the account this sales log should be assigned to?")) end end @@ -1341,7 +1343,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_3, "User must be related to owning organisation or managing organisation.", category: :setup) + errors.add(:field_3, I18n.t("#{ERROR_BASE_KEY}.assigned_to.organisation_not_related"), category: :setup) end def managing_organisation @@ -1361,7 +1363,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This organisation does not have a relationship with the owning organisation.", category: :setup) + errors.add(:field_2, I18n.t("#{ERROR_BASE_KEY}.assigned_to.managing_organisation_not_related"), category: :setup) end end end @@ -1410,13 +1412,13 @@ private fields.each do |field| if errors[field].none? block_log_creation! - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field])), category: :setup) end end else fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.invalid_option", question: format_ending(QUESTIONS[field]))) + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: format_ending(QUESTIONS[field]))) end end end @@ -1428,15 +1430,15 @@ private return if errors.key?(:field_4) || errors.key?(:field_5) || errors.key?(:field_6) unless bulk_upload.form.valid_start_date_for_form?(saledate) - errors.add(:field_4, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_5, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) - errors.add(:field_6, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_4, I18n.t("#{ERROR_BASE_KEY}.saledate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_5, I18n.t("#{ERROR_BASE_KEY}.saledate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_6, I18n.t("#{ERROR_BASE_KEY}.saledate.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) end end def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log." + error_message = I18n.t("#{ERROR_BASE_KEY}.duplicate") errors.add(:field_1, error_message) # Owning org errors.add(:field_4, error_message) # Sale completion date @@ -1472,10 +1474,10 @@ private def validate_buyer1_economic_status if field_35 == 9 if field_31.present? && field_31.to_i >= 16 - errors.add(:field_35, I18n.t("validations.sales.household.ecstat.buyer_cannot_be_over_16_and_child", buyer_index: "1")) - errors.add(:field_31, I18n.t("validations.sales.household.ecstat.buyer_cannot_be_over_16_and_child", buyer_index: "1")) + errors.add(:field_35, I18n.t("#{ERROR_BASE_KEY}.ecstat1.buyer_cannot_be_over_16_and_child")) + errors.add(:field_31, I18n.t("#{ERROR_BASE_KEY}.age1.buyer_cannot_be_over_16_and_child")) else - errors.add(:field_35, I18n.t("validations.sales.household.ecstat1.buyer_cannot_be_child")) + errors.add(:field_35, I18n.t("#{ERROR_BASE_KEY}.ecstat1.buyer_cannot_be_child")) end end end @@ -1485,23 +1487,23 @@ private if field_42 == 9 if field_38.present? && field_38.to_i >= 16 - errors.add(:field_42, I18n.t("validations.sales.household.ecstat.buyer_cannot_be_over_16_and_child", buyer_index: "2")) - errors.add(:field_38, I18n.t("validations.sales.household.ecstat.buyer_cannot_be_over_16_and_child", buyer_index: "2")) + errors.add(:field_42, I18n.t("#{ERROR_BASE_KEY}.ecstat2.buyer_cannot_be_over_16_and_child")) + errors.add(:field_38, I18n.t("#{ERROR_BASE_KEY}.age2.buyer_cannot_be_over_16_and_child")) else - errors.add(:field_42, I18n.t("validations.sales.household.ecstat2.buyer_cannot_be_child")) + errors.add(:field_42, I18n.t("#{ERROR_BASE_KEY}.ecstat2.buyer_cannot_be_child")) end end end def validate_nationality if field_34.present? && !valid_nationality_options.include?(field_34.to_s) - errors.add(:field_34, I18n.t("validations.household.nationality")) + errors.add(:field_34, I18n.t("#{ERROR_BASE_KEY}.nationality.invalid")) end end def validate_buyer_2_nationality if field_41.present? && !valid_nationality_options.include?(field_41.to_s) - errors.add(:field_41, I18n.t("validations.household.nationality")) + errors.add(:field_41, I18n.t("#{ERROR_BASE_KEY}.nationality.invalid")) end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 63d80d418..81c94b8c4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -61,14 +61,6 @@ en: <<: *bulk_upload__row_parser__base bulk_upload/sales/year2023/row_parser: <<: *bulk_upload__row_parser__base - bulk_upload/sales/validator: - attributes: - base: - blank_file: "Template is blank - The template must be filled in for us to create the logs and check if data is correct." - wrong_field_numbers_count: "Incorrect number of fields, please ensure you have used the correct template." - over_max_column_count: "Too many columns, please ensure you have used the correct template." - wrong_template: "Incorrect sale dates, please ensure you have used the correct template." - no_headers: "Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})." forms/bulk_upload_lettings/year: attributes: year: diff --git a/config/locales/validations/sales/2023/bulk_upload.en.yml b/config/locales/validations/sales/2023/bulk_upload.en.yml new file mode 100644 index 000000000..517f56858 --- /dev/null +++ b/config/locales/validations/sales/2023/bulk_upload.en.yml @@ -0,0 +1,29 @@ +en: + validations: + sales: + 2023: + bulk_upload: + not_answered: "You must answer %{question}" + invalid_option: "Enter a valid value for %{question}" + spreadsheet_dupe: "This is a duplicate of a log in your file." + duplicate: "This is a duplicate log." + blank_file: "Template is blank - The template must be filled in for us to create the logs and check if data is correct." + wrong_template: + wrong_template: "Incorrect sale dates, please ensure you have used the correct template." + no_headers: "Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})." + wrong_field_numbers_count: "Incorrect number of fields, please ensure you have used the correct template." + over_max_column_count: "Too many columns, please ensure you have used the correct template." + owning_organisation: + not_answered: "The owning organisation code is incorrect." + not_found: "The owning organisation code is incorrect." + not_stock_owner: "The owning organisation code provided is for an organisation that does not own stock." + not_permitted: "You do not have permission to add logs for this owning organisation." + assigned_to: + not_found: "User with the specified email could not be found." + organisation_not_related: "User must be related to owning organisation or managing organisation." + managing_organisation_not_related: "This user belongs to an organisation that does not have a relationship with the owning organisation." + saledate: + outside_collection_window: "Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year}." + year_not_two_or_four_digits: "Sale completion year must be 2 or 4 digits." + ecstat1: + child_under_16: "Buyer 1 cannot be a child under 16." diff --git a/config/locales/validations/sales/2024/bulk_upload.en.yml b/config/locales/validations/sales/2024/bulk_upload.en.yml new file mode 100644 index 000000000..fc68662d1 --- /dev/null +++ b/config/locales/validations/sales/2024/bulk_upload.en.yml @@ -0,0 +1,44 @@ +en: + validations: + sales: + 2024: + bulk_upload: + not_answered: "You must answer %{question}" + invalid_option: "Enter a valid value for %{question}" + spreadsheet_dupe: "This is a duplicate of a log in your file." + duplicate: "This is a duplicate log." + blank_file: "Template is blank - The template must be filled in for us to create the logs and check if data is correct." + wrong_template: + over_max_column_count: "Too many columns, please ensure you have used the correct template." + no_headers: "Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})." + wrong_field_numbers_count: "Incorrect number of fields, please ensure you have used the correct template." + wrong_template: "Incorrect sale dates, please ensure you have used the correct template." + numeric: + within_range: "%{field} must be between %{min} and %{max}." + owning_organisation: + not_found: "The owning organisation code is incorrect." + not_stock_owner: "The owning organisation code provided is for an organisation that does not own stock." + not_permitted: + support: "This owning organisation is not affiliated with %(name)." + not_support: "You do not have permission to add logs for this owning organisation." + assigned_to: + not_found: "User with the specified email could not be found." + organisation_not_related: "User must be related to owning organisation or managing organisation." + managing_organisation_not_related: "This organisation does not have a relationship with the owning organisation." + saledate: + outside_collection_window: "Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year}." + year_not_two_or_four_digits: "Sale completion year must be 2 or 4 digits." + ecstat1: + buyer_cannot_be_over_16_and_child: "Buyer 1's age cannot be 16 or over if their working situation is child under 16." + buyer_cannot_be_child: "Buyer 1 cannot have a working situation of child under 16." + age1: + buyer_cannot_be_over_16_and_child: "Buyer 1's age cannot be 16 or over if their working situation is child under 16." + ecstat2: + buyer_cannot_be_over_16_and_child: "Buyer 2's age cannot be 16 or over if their working situation is child under 16." + buyer_cannot_be_child: "Buyer 2 cannot have a working situation of child under 16." + age2: + buyer_cannot_be_over_16_and_child: "Buyer 2's age cannot be 16 or over if their working situation is child under 16." + address: + not_found: "We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site." + nationality: + invalid: "Select a valid nationality." diff --git a/spec/services/bulk_upload/sales/validator_spec.rb b/spec/services/bulk_upload/sales/validator_spec.rb index d196126c9..c275ce681 100644 --- a/spec/services/bulk_upload/sales/validator_spec.rb +++ b/spec/services/bulk_upload/sales/validator_spec.rb @@ -15,7 +15,7 @@ RSpec.describe BulkUpload::Sales::Validator do context "when file is empty" do it "is not valid" do expect(validator).not_to be_valid - expect(validator.errors["base"]).to eql(["Template is blank - The template must be filled in for us to create the logs and check if data is correct."]) + expect(validator.errors["base"]).to eql([I18n.t("validations.sales.2024.bulk_upload.blank_file")]) end end @@ -27,7 +27,7 @@ RSpec.describe BulkUpload::Sales::Validator do it "is not valid" do expect(validator).not_to be_valid - expect(validator.errors["base"]).to eql(["Template is blank - The template must be filled in for us to create the logs and check if data is correct."]) + expect(validator.errors["base"]).to eql([I18n.t("validations.sales.2024.bulk_upload.blank_file")]) end end @@ -54,7 +54,7 @@ RSpec.describe BulkUpload::Sales::Validator do it "is not valid" do expect(validator).not_to be_valid - expect(validator.errors["base"]).to eql(["Incorrect sale dates, please ensure you have used the correct template."]) + expect(validator.errors["base"]).to eql([I18n.t("validations.sales.2024.bulk_upload.wrong_template.wrong_template")]) end end diff --git a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb index 70bd923e6..2994a418e 100644 --- a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb @@ -406,7 +406,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { setup_section_params.merge(field_1: nil) } it "is not permitted as setup error" do - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.sales.2023.bulk_upload.not_answered", question: "owning organisation.")]) end it "blocks log creation" do @@ -418,7 +418,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: "donotexist" } } it "is not permitted as a setup error" do - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.sales.2023.bulk_upload.not_answered", question: "owning organisation.")]) end it "blocks log creation" do @@ -432,7 +432,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: unaffiliated_org.old_visible_id } } it "is not permitted as setup error" do - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You do not have permission to add logs for this owning organisation."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.sales.2023.bulk_upload.owning_organisation.not_permitted")]) end it "blocks log creation" do @@ -608,7 +608,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do it "returns a setup error" do parser.valid? - expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to include("Sale completion year must be 2 or 4 digits.") + expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to include(I18n.t("validations.sales.2023.bulk_upload.saledate.year_not_two_or_four_digits")) end end @@ -672,7 +672,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.sales.2023.bulk_upload.duplicate") [ :field_1, # Owning org @@ -932,7 +932,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do it "does not set ##{age}" do parser.valid? - expect(parser.errors[field.to_sym]).to include(/You must answer/) + expect(parser.errors[field.to_sym]).to include(/#{I18n.t("validations.sales.2023.bulk_upload.not_answered", question: "")}/) end end end @@ -980,7 +980,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { valid_attributes.merge({ field_35: "9" }) } it "a custom validation is applied" do - validation_message = "Buyer 1 cannot be a child under 16." + validation_message = I18n.t("validations.sales.2023.bulk_upload.ecstat1.child_under_16") expect(parser.errors[:field_35]).to include validation_message end end @@ -1052,7 +1052,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { setup_section_params.merge(field_105: "4") } it "returns correct errors" do - expect(parser.errors[:field_105]).to include("Enter a valid value for was a mortgage used for the purchase of this property? - Shared ownership.") + expect(parser.errors[:field_105]).to include(I18n.t("validations.sales.2023.bulk_upload.invalid_option", question: "was a mortgage used for the purchase of this property? - Shared ownership.")) parser.log.blank_invalid_non_setup_fields! parser.log.save! expect(parser.log.mortgageused).to be_nil @@ -1420,7 +1420,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This user belongs to an organisation that does not have a relationship with the owning organisation.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.sales.2023.bulk_upload.assigned_to.managing_organisation_not_related")) end it "blocks log creation" do @@ -1442,7 +1442,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.sales.2023.bulk_upload.owning_organisation.not_stock_owner")) end it "blocks log creation" do diff --git a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb index d1d4aeb53..4844ce490 100644 --- a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb @@ -301,7 +301,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "fetches the question's check_answer_label if it exists" do parser.valid? - expect(parser.errors[:field_32]).to eql(["You must answer buyer 1’s gender identity."]) + expect(parser.errors[:field_32]).to eql([I18n.t("validations.not_answered", question: "buyer 1’s gender identity.")]) end end @@ -310,7 +310,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "only has one error added to the field" do parser.valid? - expect(parser.errors[:field_23]).to eql(["You must answer address line 1."]) + expect(parser.errors[:field_23]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "address line 1.")]) end end @@ -320,7 +320,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "does not add an additional error" do parser.valid? expect(parser.errors[:field_35].length).to eq(1) - expect(parser.errors[:field_35]).to include(match "Enter a valid value for") + expect(parser.errors[:field_35]).to include(match I18n.t("validations.sales.2024.bulk_upload.invalid_option", question: "")) end end end @@ -463,7 +463,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "is not permitted as setup error" do parser.valid? - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "owning organisation.")]) end it "blocks log creation" do @@ -477,7 +477,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "is not permitted as a setup error" do parser.valid? - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["The owning organisation code is incorrect."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.sales.2024.bulk_upload.owning_organisation.not_found")]) end it "blocks log creation" do @@ -493,7 +493,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "is not permitted as setup error" do parser.valid? - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You do not have permission to add logs for this owning organisation."]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql([I18n.t("validations.sales.2024.bulk_upload.owning_organisation.not_permitted.not_support")]) end it "blocks log creation" do @@ -580,7 +580,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser = described_class.new(attributes) parser.valid? expect(parser).to be_block_log_creation - expect(parser.errors[:field_1]).to include("You do not have permission to add logs for this owning organisation.") + expect(parser.errors[:field_1]).to include(I18n.t("validations.sales.2024.bulk_upload.owning_organisation.not_permitted.not_support")) end end @@ -598,7 +598,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "does not block log creation and does not add an error to field_1" do parser = described_class.new(attributes) parser.valid? - expect(parser.errors[:field_1]).not_to include("You do not have permission to add logs for this owning organisation.") + expect(parser.errors[:field_1]).not_to include(I18n.t("validations.sales.2024.bulk_upload.owning_organisation.not_permitted.not_support")) end end end @@ -631,7 +631,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "is not permitted" do parser.valid? expect(parser.errors[:field_3]).to be_present - expect(parser.errors[:field_3]).to include("You must answer what is the CORE username of the account this sales log should be assigned to?") + expect(parser.errors[:field_3]).to include(I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "what is the CORE username of the account this sales log should be assigned to?")) end it "blocks log creation" do @@ -736,7 +736,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns a setup error" do parser.valid? - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include("Sale completion year must be 2 or 4 digits.") + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include(I18n.t("validations.sales.2024.bulk_upload.saledate.year_not_two_or_four_digits")) end end @@ -802,7 +802,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log." + error_message = I18n.t("validations.sales.2024.bulk_upload.duplicate") [ :field_1, # Owning org @@ -891,7 +891,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns correct error" do parser.valid? - expect(parser.errors.where(:field_116).map(&:message)).to include("Percentage discount must be between 0% and 70%.") + expect(parser.errors.where(:field_116).map(&:message)).to include(I18n.t("validations.sales.2024.bulk_upload.numeric.within_range", field: "Percentage discount", min: "0%", max: "70%")) end end @@ -909,7 +909,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns correct error" do parser.valid? - expect(parser.errors.where(:field_116).map(&:message)).to include("Percentage discount must be between 0% and 70%.") + expect(parser.errors.where(:field_116).map(&:message)).to include(I18n.t("validations.sales.2024.bulk_upload.numeric.within_range", field: "Percentage discount", min: "0%", max: "70%")) end end end @@ -942,7 +942,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns setup error" do parser.valid? - expect(parser.errors.where(:field_13).map(&:message)).to include("Enter a valid value for is the buyer a company?") + expect(parser.errors.where(:field_13).map(&:message)).to include(I18n.t("validations.invalid_option", question: "is the buyer a company?")) expect(parser.errors.where(:field_13, category: :setup)).to be_present end end @@ -954,7 +954,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns setup error" do parser.valid? - expect(parser.errors.where(:field_14).map(&:message)).to eql(["Enter a valid value for will the buyers live in the property?"]) + expect(parser.errors.where(:field_14).map(&:message)).to eql([I18n.t("validations.invalid_option", question: "will the buyers live in the property?")]) expect(parser.errors.where(:field_14, category: :setup)).to be_present end end @@ -1011,10 +1011,10 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "adds errors to missing key address fields" do parser.valid? - expect(parser.errors[:field_23]).to eql(["You must answer address line 1."]) - expect(parser.errors[:field_25]).to eql(["You must answer town or city."]) - expect(parser.errors[:field_27]).to eql(["You must answer part 1 of postcode."]) - expect(parser.errors[:field_28]).to eql(["You must answer part 2 of postcode."]) + expect(parser.errors[:field_23]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "address line 1.")]) + expect(parser.errors[:field_25]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "town or city.")]) + expect(parser.errors[:field_27]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "part 1 of postcode.")]) + expect(parser.errors[:field_28]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "part 2 of postcode.")]) end end @@ -1042,11 +1042,11 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "adds appropriate errors to UPRN and key address fields" do parser.valid? - expect(parser.errors[:field_22]).to eql(["You must answer UPRN."]) - expect(parser.errors[:field_23]).to eql(["You must answer address line 1."]) - expect(parser.errors[:field_25]).to eql(["You must answer town or city."]) - expect(parser.errors[:field_27]).to eql(["You must answer part 1 of postcode."]) - expect(parser.errors[:field_28]).to eql(["You must answer part 2 of postcode."]) + expect(parser.errors[:field_22]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "UPRN.")]) + expect(parser.errors[:field_23]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "address line 1.")]) + expect(parser.errors[:field_25]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "town or city.")]) + expect(parser.errors[:field_27]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "part 1 of postcode.")]) + expect(parser.errors[:field_28]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "part 2 of postcode.")]) end end @@ -1055,8 +1055,8 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "adds errors to UPRN and the missing key address field" do parser.valid? - expect(parser.errors[:field_22]).to eql(["You must answer UPRN."]) - expect(parser.errors[:field_23]).to eql(["You must answer address line 1."]) + expect(parser.errors[:field_22]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "UPRN.")]) + expect(parser.errors[:field_23]).to eql([I18n.t("validations.sales.2024.bulk_upload.not_answered", question: "address line 1.")]) expect(parser.errors[:field_25]).to be_empty expect(parser.errors[:field_27]).to be_empty expect(parser.errors[:field_28]).to be_empty @@ -1090,7 +1090,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? expect(parser.errors[:field_22]).to be_empty %i[field_23 field_24 field_25 field_26 field_27 field_28].each do |field| - expect(parser.errors[field]).to eql(["We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site."]) + expect(parser.errors[field]).to eql([I18n.t("validations.sales.2024.bulk_upload.address.not_found")]) end end end @@ -1105,7 +1105,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? expect(parser.errors[:field_22]).to be_empty %i[field_23 field_24 field_25 field_26 field_27 field_28].each do |field| - expect(parser.errors[field]).to eql(["We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site."]) + expect(parser.errors[field]).to eql([I18n.t("validations.sales.2024.bulk_upload.address.not_found")]) end end end @@ -1218,8 +1218,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "a custom validation is applied" do parser.valid? - validation_message = "Buyer 2 cannot have a working situation of child under 16." - expect(parser.errors[:field_42]).to include validation_message + expect(parser.errors[:field_42]).to include I18n.t("validations.sales.2024.bulk_upload.ecstat2.buyer_cannot_be_child") end end @@ -1240,9 +1239,8 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "a custom validation is applied" do parser.valid? - validation_message = "Buyer 2's age cannot be 16 or over if their working situation is child under 16." - expect(parser.errors[:field_42]).to include validation_message - expect(parser.errors[:field_38]).to include validation_message + expect(parser.errors[:field_42]).to include I18n.t("validations.sales.2024.bulk_upload.ecstat2.buyer_cannot_be_over_16_and_child") + expect(parser.errors[:field_38]).to include I18n.t("validations.sales.2024.bulk_upload.age2.buyer_cannot_be_over_16_and_child") end end @@ -1264,8 +1262,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "a custom validation is applied" do parser.valid? - validation_message = "Buyer 1 cannot have a working situation of child under 16." - expect(parser.errors[:field_35]).to include validation_message + expect(parser.errors[:field_35]).to include I18n.t("validations.sales.2024.bulk_upload.ecstat1.buyer_cannot_be_child") end end @@ -1286,9 +1283,8 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "a custom validation is applied" do parser.valid? - validation_message = "Buyer 1's age cannot be 16 or over if their working situation is child under 16." - expect(parser.errors[:field_35]).to include validation_message - expect(parser.errors[:field_31]).to include validation_message + expect(parser.errors[:field_35]).to include I18n.t("validations.sales.2024.bulk_upload.ecstat1.buyer_cannot_be_over_16_and_child") + expect(parser.errors[:field_31]).to include I18n.t("validations.sales.2024.bulk_upload.age1.buyer_cannot_be_over_16_and_child") end end end @@ -1333,7 +1329,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns correct errors" do parser.valid? - expect(parser.errors[:field_103]).to include("Enter a valid value for was a mortgage used for the purchase of this property? - Shared ownership.") + expect(parser.errors[:field_103]).to include(I18n.t("validations.sales.2024.bulk_upload.invalid_option", question: "was a mortgage used for the purchase of this property? - Shared ownership.")) parser.log.blank_invalid_non_setup_fields! parser.log.save! @@ -1370,7 +1366,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns correct errors" do parser.valid? - expect(parser.errors[:field_103]).to include("Enter a valid value for was a mortgage used for the purchase of this property?") + expect(parser.errors[:field_103]).to include(I18n.t("validations.invalid_option", question: "was a mortgage used for the purchase of this property?")) parser.log.blank_invalid_non_setup_fields! parser.log.save! @@ -1383,7 +1379,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns correct errors" do parser.valid? - expect(parser.errors[:field_103]).to include("Enter a valid value for was a mortgage used for the purchase of this property?") + expect(parser.errors[:field_103]).to include(I18n.t("validations.invalid_option", question: "was a mortgage used for the purchase of this property?")) parser.log.blank_invalid_non_setup_fields! parser.log.save! @@ -1440,7 +1436,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "does not allow 3 (don't know) as an option for discounted ownership" do parser.valid? - expect(parser.errors[:field_117]).to include("Enter a valid value for was a mortgage used for the purchase of this property?") + expect(parser.errors[:field_117]).to include(I18n.t("validations.invalid_option", question: "was a mortgage used for the purchase of this property?")) parser.log.blank_invalid_non_setup_fields! parser.log.save! @@ -1696,7 +1692,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? expect(parser.log.nationality_all).to be(nil) expect(parser.log.nationality_all_group).to be(nil) - expect(parser.errors["field_34"]).to include("Select a valid nationality.") + expect(parser.errors["field_34"]).to include(I18n.t("validations.sales.2024.bulk_upload.nationality.invalid")) end end end @@ -1781,7 +1777,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? expect(parser.log.nationality_all_buyer2).to be(nil) expect(parser.log.nationality_all_buyer2_group).to be(nil) - expect(parser.errors["field_41"]).to include("Select a valid nationality.") + expect(parser.errors["field_41"]).to include(I18n.t("validations.sales.2024.bulk_upload.nationality.invalid")) end end end @@ -1983,7 +1979,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer reported by.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.not_answered", question: "reported by.")) end it "blocks log creation" do @@ -1999,7 +1995,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer reported by.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.not_answered", question: "reported by.")) end it "blocks log creation" do @@ -2017,7 +2013,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This organisation does not have a relationship with the owning organisation.") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql(I18n.t("validations.sales.2024.bulk_upload.assigned_to.managing_organisation_not_related")) end it "blocks log creation" do @@ -2039,7 +2035,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql(I18n.t("validations.sales.2024.bulk_upload.owning_organisation.not_stock_owner")) end it "blocks log creation" do From ee3018b94435e6d037353c48021cccced6b534d4 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:14:59 +0000 Subject: [PATCH 07/27] CLDC-3066: Show filters button bug (#2748) * Add show filters toggle to user and scheme pages * Adjust spacing between buttons to match show filters button --- app/components/create_log_actions_component.html.erb | 2 +- app/views/logs/_create_for_org_actions.html.erb | 10 +++++----- app/views/organisations/schemes.html.erb | 4 +++- app/views/organisations/users.html.erb | 8 +++++--- app/views/schemes/index.html.erb | 10 +++++----- app/views/users/index.html.erb | 4 ++-- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/components/create_log_actions_component.html.erb b/app/components/create_log_actions_component.html.erb index 8af78b169..2e88034d7 100644 --- a/app/components/create_log_actions_component.html.erb +++ b/app/components/create_log_actions_component.html.erb @@ -1,6 +1,6 @@ <% if display_actions? %>
- <%= govuk_button_to create_button_copy, create_button_href, class: "govuk-!-margin-right-6" %> + <%= govuk_button_to create_button_copy, create_button_href, class: "govuk-!-margin-right-3" %> <% unless user.support? %> <%= govuk_button_link_to upload_button_copy, upload_button_href, secondary: true %> <% end %> diff --git a/app/views/logs/_create_for_org_actions.html.erb b/app/views/logs/_create_for_org_actions.html.erb index 9b5935cb0..76b8f7d0d 100644 --- a/app/views/logs/_create_for_org_actions.html.erb +++ b/app/views/logs/_create_for_org_actions.html.erb @@ -1,13 +1,13 @@ -
+
<% if @organisation.data_protection_confirmed? %> <% if current_page?(controller: 'organisations', action: 'lettings_logs') %> - <%= govuk_button_to "Create a new lettings log", lettings_logs_path(lettings_log: { owning_organisation_id: @organisation.id }, method: :post), class: "govuk-!-margin-right-6" %> - <%= govuk_button_link_to "Upload lettings logs in bulk", bulk_upload_lettings_log_path(id: "start", organisation_id: @organisation.id), secondary: true, class: "govuk-!-margin-right-6" %> + <%= govuk_button_to "Create a new lettings log", lettings_logs_path(lettings_log: { owning_organisation_id: @organisation.id }, method: :post), class: "govuk-!-margin-right-3" %> + <%= govuk_button_link_to "Upload lettings logs in bulk", bulk_upload_lettings_log_path(id: "start", organisation_id: @organisation.id), secondary: true, class: "govuk-!-margin-right-3" %> <%= govuk_button_link_to "View lettings bulk uploads", bulk_uploads_lettings_logs_path(organisation_id: @organisation.id, clear_old_filters: true), secondary: true %> <% end %> <% if current_page?(controller: 'organisations', action: 'sales_logs') %> - <%= govuk_button_to "Create a new sales log", sales_logs_path(sales_log: { owning_organisation_id: @organisation.id }, method: :post), class: "govuk-!-margin-right-6" %> - <%= govuk_button_link_to "Upload sales logs in bulk", bulk_upload_sales_log_path(id: "start", organisation_id: @organisation.id), secondary: true, class: "govuk-!-margin-right-6" %> + <%= govuk_button_to "Create a new sales log", sales_logs_path(sales_log: { owning_organisation_id: @organisation.id }, method: :post), class: "govuk-!-margin-right-3" %> + <%= govuk_button_link_to "Upload sales logs in bulk", bulk_upload_sales_log_path(id: "start", organisation_id: @organisation.id), secondary: true, class: "govuk-!-margin-right-3" %> <%= govuk_button_link_to "View sales bulk uploads", bulk_uploads_sales_logs_path(organisation_id: @organisation.id, clear_old_filters: true), secondary: true %> <% end %> <% end %> diff --git a/app/views/organisations/schemes.html.erb b/app/views/organisations/schemes.html.erb index b9706d4db..0fda1d359 100644 --- a/app/views/organisations/schemes.html.erb +++ b/app/views/organisations/schemes.html.erb @@ -23,7 +23,9 @@
<% if SchemePolicy.new(current_user, nil).create? %> - <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> +
+ <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> +
<% end %> <%= govuk_details( diff --git a/app/views/organisations/users.html.erb b/app/views/organisations/users.html.erb index f1a6336ce..73a460276 100644 --- a/app/views/organisations/users.html.erb +++ b/app/views/organisations/users.html.erb @@ -12,10 +12,12 @@

Users

<% end %> -<% if current_user.data_coordinator? || current_user.support? %> - <%= govuk_button_link_to "Invite user", new_user_path(organisation_id: @organisation.id), html: { method: :get } %> -<% end %>
+
+ <% if current_user.data_coordinator? || current_user.support? %> + <%= govuk_button_link_to "Invite user", new_user_path(organisation_id: @organisation.id), html: { method: :get } %> + <% end %> +
<%= render partial: "users/user_filters" %>
diff --git a/app/views/schemes/index.html.erb b/app/views/schemes/index.html.erb index edaed6212..9cbc95fdb 100644 --- a/app/views/schemes/index.html.erb +++ b/app/views/schemes/index.html.erb @@ -5,12 +5,12 @@ <%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Supported housing schemes", sub: nil } : { main: "Supported housing schemes", sub: current_user.organisation.name } %> -<% if SchemePolicy.new(current_user, nil).create? %> -
- <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> -
-<% end %>
+ <% if SchemePolicy.new(current_user, nil).create? %> +
+ <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> +
+ <% end %> <%= render partial: "schemes/scheme_filters" %>
<%= render SearchComponent.new(current_user:, search_label: "Search by postcode, scheme name, scheme code or location name", value: @searched) %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 4e5053563..dd454464d 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -5,12 +5,12 @@ <%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Users", sub: nil } : { main: "Users", sub: current_user.organisation.name } %> +
<% if current_user.data_coordinator? || current_user.support? %> -
+
<%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %>
<% end %> -
<%= render partial: "users/user_filters" %>
<%= render SearchComponent.new(current_user:, search_label: "Search by name or email address", value: @searched) %> From 1d23f9e50a9980553d65197c0e203c97b274fb34 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Thu, 7 Nov 2024 13:18:30 +0000 Subject: [PATCH 08/27] CLDC-3716: Allow 25/26 form use on dev, review, and staging environments (#2749) * CLDC-3716: Allow 25/26 form use on dev, review, and staging environments * Remove empty line --- app/helpers/filters_helper.rb | 6 +- app/services/feature_toggle.rb | 2 +- .../lettings/household_characteristics.en.yml | 0 .../forms/2025/lettings/guidance.en.yml | 63 ++++ .../lettings/household_characteristics.en.yml | 322 ++++++++++++++++ .../2025/lettings/household_needs.en.yml | 57 +++ .../2025/lettings/household_situation.en.yml | 120 ++++++ .../2025/lettings/income_and_benefits.en.yml | 108 ++++++ .../2025/lettings/property_information.en.yml | 127 +++++++ .../locales/forms/2025/lettings/setup.en.yml | 87 +++++ .../2025/lettings/tenancy_information.en.yml | 66 ++++ .../locales/forms/2025/sales/guidance.en.yml | 46 +++ .../sales/household_characteristics.en.yml | 345 ++++++++++++++++++ .../forms/2025/sales/household_needs.en.yml | 34 ++ .../2025/sales/household_situation.en.yml | 50 +++ .../sales/income_benefits_and_savings.en.yml | 90 +++++ .../2025/sales/property_information.en.yml | 91 +++++ .../forms/2025/sales/sale_information.en.yml | 206 +++++++++++ config/locales/forms/2025/sales/setup.en.yml | 110 ++++++ .../forms/2025/sales/soft_validations.en.yml | 244 +++++++++++++ spec/helpers/filters_helper_spec.rb | 46 ++- 21 files changed, 2212 insertions(+), 8 deletions(-) rename config/locales/forms/2024/{sales => }/lettings/household_characteristics.en.yml (100%) create mode 100644 config/locales/forms/2025/lettings/guidance.en.yml create mode 100644 config/locales/forms/2025/lettings/household_characteristics.en.yml create mode 100644 config/locales/forms/2025/lettings/household_needs.en.yml create mode 100644 config/locales/forms/2025/lettings/household_situation.en.yml create mode 100644 config/locales/forms/2025/lettings/income_and_benefits.en.yml create mode 100644 config/locales/forms/2025/lettings/property_information.en.yml create mode 100644 config/locales/forms/2025/lettings/setup.en.yml create mode 100644 config/locales/forms/2025/lettings/tenancy_information.en.yml create mode 100644 config/locales/forms/2025/sales/guidance.en.yml create mode 100644 config/locales/forms/2025/sales/household_characteristics.en.yml create mode 100644 config/locales/forms/2025/sales/household_needs.en.yml create mode 100644 config/locales/forms/2025/sales/household_situation.en.yml create mode 100644 config/locales/forms/2025/sales/income_benefits_and_savings.en.yml create mode 100644 config/locales/forms/2025/sales/property_information.en.yml create mode 100644 config/locales/forms/2025/sales/sale_information.en.yml create mode 100644 config/locales/forms/2025/sales/setup.en.yml create mode 100644 config/locales/forms/2025/sales/soft_validations.en.yml diff --git a/app/helpers/filters_helper.rb b/app/helpers/filters_helper.rb index 35fea17e9..3a4c337ea 100644 --- a/app/helpers/filters_helper.rb +++ b/app/helpers/filters_helper.rb @@ -143,7 +143,11 @@ module FiltersHelper } if FormHandler.instance.in_crossover_period? - return years.merge({ archived_collection_start_year.to_s => year_combo(archived_collection_start_year) }) + years = years.merge({ archived_collection_start_year.to_s => year_combo(archived_collection_start_year) }) + end + + if FeatureToggle.allow_future_form_use? + years = { next_collection_start_year.to_s => year_combo(next_collection_start_year) }.merge(years) end years diff --git a/app/services/feature_toggle.rb b/app/services/feature_toggle.rb index 5312d1964..1b67b8b37 100644 --- a/app/services/feature_toggle.rb +++ b/app/services/feature_toggle.rb @@ -1,6 +1,6 @@ class FeatureToggle def self.allow_future_form_use? - false + Rails.env.development? || Rails.env.review? || Rails.env.staging? end def self.bulk_upload_duplicate_log_check_enabled? diff --git a/config/locales/forms/2024/sales/lettings/household_characteristics.en.yml b/config/locales/forms/2024/lettings/household_characteristics.en.yml similarity index 100% rename from config/locales/forms/2024/sales/lettings/household_characteristics.en.yml rename to config/locales/forms/2024/lettings/household_characteristics.en.yml diff --git a/config/locales/forms/2025/lettings/guidance.en.yml b/config/locales/forms/2025/lettings/guidance.en.yml new file mode 100644 index 000000000..340eb11d5 --- /dev/null +++ b/config/locales/forms/2025/lettings/guidance.en.yml @@ -0,0 +1,63 @@ +en: + forms: + 2025: + lettings: + guidance: + finding_location: + title: "What is a location?" + content: "A location is a postcode area where supported housing is provided under a scheme. A scheme can have multiple locations, and a location can have multiple units at the same postcode." + scheme_changes_link_text: "Read more about schemes and locations" + + finding_scheme: + title: "Can’t find your scheme?" + content: "

Schemes are attached to the organisation that owns the property. Check you have correctly answered question 1 \"Which organisation owns this property?\"

+

If your organisation’s schemes were migrated from old CORE, they may have new names and codes. Search by postcode to find your scheme.

" + scheme_changes_link_text: "Read more about how schemes have changed" + view_schemes_link_text: "View your organisation’s schemes" + + privacy_notice_tenant: + content: "Make sure the lead tenant has seen or been given access to %{privacy_notice_link} before completing this log. This is a legal requirement under data protection legislation." + privacy_notice_link_text: "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice" + + rent_type_definitions: + title: "Rent type definitions" + content: "

Social Rent: where target rents are determined through the national rent regime. This is sometimes also known as 'formula rent'.

+

Affordable Rent: where up to 80% of market rent can be charged. A new supply agreement is signed with Homes England or the Greater London Authority (GLA).

+

London Affordable Rent: a tenure of affordable housing available in London by the GLA. It is an affordable rent which must be set in accordance with the Regulator of Social Housing’s Affordable Rent guidance. The landlord of these homes must be registered with the Regulator of Social Housing. These are a type of Affordable Rent lettings.

+

Rent to Buy: a discount of up to 20% market rent is charged for a single rental period for a minimum of 5 years. After that period, the tenant is offered first chance to purchase the property (either shared ownership or outright) at full market value. These are a type of Intermediate Rent lettings.

+

London Living Rent: a tenure of affordable housing available in London by the GLA. It was introduced in Affordable Homes Programme 2016 to 2021. These are a type of Intermediate Rent lettings.

+

Other intermediate rent: any other specific scheme where up to 80% of market rent can be charged. This includes schemes with reduced rent so tenants can save towards a house purchasing deposit and schemes with an in-built future opportunity to buy the property being rented.

" + + scheme_selection: + data_provider: + content: "If you’re not sure which scheme to choose, ask a data coordinator. Find your data coordinators on the %{users_page_link}." + users_page_link_text: "users page" + data_coordinator: + create_scheme_link_text: "Create a new supported housing scheme" + + void_date: + title: "What is a void date?" + content: "

Date the property was (legally or contractually) available to let, or for:

+
    +
  • re-lets: the day after the previous tenant's contract ended
  • +
  • new builds: the day the landlord legally first owned the property (‘completion date’)
  • +
  • new conversions or acquisitions: completion date, or the day after rehabilitation work ended
  • +
  • new leases: the day the landlord got contractual property rights and could let it out to tenants
  • +
" + + what_counts_as_income: + title: "What counts as income?" + content: "

You should include any income after tax from:

+
    +
  • employment
  • +
  • pensions
  • +
  • Universal Credit
  • +
+ +

Don’t include:

+
    +
  • National Insurance (NI) contributions and tax
  • +
  • housing benefit
  • +
  • child benefit
  • +
  • council tax support
  • +
" diff --git a/config/locales/forms/2025/lettings/household_characteristics.en.yml b/config/locales/forms/2025/lettings/household_characteristics.en.yml new file mode 100644 index 000000000..1aef9297a --- /dev/null +++ b/config/locales/forms/2025/lettings/household_characteristics.en.yml @@ -0,0 +1,322 @@ +en: + forms: + 2025: + lettings: + household_characteristics: + hhmemb: + page_header: "" + check_answer_label: "Number of household members" + hint_text: "You can provide details for a maximum of 8 people." + question_text: "How many people live in the household for this letting?" + + age1: + page_header: "" + age1_known: + check_answer_label: "" + hint_text: "The ’lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same amount of paid work, the lead tenant is whoever is the oldest." + question_text: "Do you know the lead tenant’s age?" + age1: + check_answer_label: "Lead tenant’s age" + hint_text: "" + question_text: "Age" + + sex1: + page_header: "" + check_answer_label: "Lead tenant’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes the lead tenant’s gender identity?" + + ethnic_group: + page_header: "" + check_answer_label: "Lead tenant’s ethnic group" + hint_text: "" + question_text: "What is the lead tenant’s ethnic group?" + + ethnic: + ethnic_background_black: + page_header: "" + check_answer_label: "Lead tenant’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes lead tenant’s Black, African, Caribbean or Black British background?" + ethnic_background_asian: + page_header: "" + check_answer_label: "Lead tenant’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes lead tenant’s Asian or Asian British background?" + ethnic_background_arab: + page_header: "" + check_answer_label: "Lead tenant’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes the lead tenant’s Arab background?" + ethnic_background_mixed: + page_header: "" + check_answer_label: "Lead tenant’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes lead tenant’s Mixed or Multiple ethnic groups background?" + ethnic_background_white: + page_header: "" + check_answer_label: "Lead tenant’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes lead tenant’s White background?" + + nationality_all: + page_header: "" + nationality_all: + check_answer_label: "Lead tenant’s nationality" + hint_text: "" + question_text: "Enter a nationality" + nationality_all_group: + check_answer_label: "Lead tenant’s nationality" + hint_text: "If the lead tenant is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the tenant should decide which country to enter." + question_text: "What is the nationality of the lead tenant?" + + ecstat1: + page_header: "" + check_answer_label: "Lead tenant’s working situation" + hint_text: "" + question_text: "Which of these best describes the lead tenant’s working situation?" + + details_known_2: + page_header: "You’ve given us the details for 1 person in the household" + check_answer_label: "Details known for person 2" + hint_text: "You must provide details for everyone in the household if you know them." + question_text: "Do you know details for person 2?" + + relat2: + page_header: "" + check_answer_label: "Person 2’s relationship to the lead tenant" + hint_text: "" + question_text: "What is person 2’s relationship to the lead tenant?" + + age2: + page_header: "" + age2_known: + check_answer_label: "" + hint_text: "" + question_text: "Do you know person 2’s age?" + age2: + check_answer_label: "Person 2’s age" + hint_text: "Answer 1 for children aged under 1 year old" + question_text: "Age" + + sex2: + page_header: "" + check_answer_label: "Person 2’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes person 2’s gender identity?" + + ecstat2: + page_header: "" + check_answer_label: "Person 2’s working situation" + hint_text: "" + question_text: "Which of these best describes person 2’s working situation?" + + details_known_3: + page_header: "You’ve given us the details for 2 people in the household" + check_answer_label: "Details known for person 3" + hint_text: "You must provide details for everyone in the household if you know them." + question_text: "Do you know details for person 3?" + + relat3: + page_header: "" + check_answer_label: "Person 3’s relationship to the lead tenant" + hint_text: "" + question_text: "What is person 3’s relationship to the lead tenant?" + + age3: + page_header: "" + age3_known: + check_answer_label: "" + hint_text: "" + question_text: "Do you know person 3’s age?" + age3: + check_answer_label: "Person 3’s age" + hint_text: "Answer 1 for children aged under 1 year old" + question_text: "Age" + + sex3: + page_header: "" + check_answer_label: "Person 3’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes person 3’s gender identity?" + + ecstat3: + page_header: "" + check_answer_label: "Person 3’s working situation" + hint_text: "" + question_text: "Which of these best describes person 3’s working situation?" + + details_known_4: + page_header: "You’ve given us the details for 3 people in the household" + check_answer_label: "Details known for person 4" + hint_text: "You must provide details for everyone in the household if you know them." + question_text: "Do you know details for person 4?" + + relat4: + page_header: "" + check_answer_label: "Person 4’s relationship to the lead tenant" + hint_text: "" + question_text: "What is person 4’s relationship to the lead tenant?" + + age4: + page_header: "" + age4_known: + check_answer_label: "" + hint_text: "" + question_text: "Do you know person 4’s age?" + age4: + check_answer_label: "Person 4’s age" + hint_text: "Answer 1 for children aged under 1 year old" + question_text: "Age" + + sex4: + page_header: "" + check_answer_label: "Person 4’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes person 4’s gender identity?" + + ecstat4: + page_header: "" + check_answer_label: "Person 4’s working situation" + hint_text: "" + question_text: "Which of these best describes person 4’s working situation?" + + details_known_5: + page_header: "You’ve given us the details for 4 people in the household" + check_answer_label: "Details known for person 5" + hint_text: "You must provide details for everyone in the household if you know them." + question_text: "Do you know details for person 5?" + + relat5: + page_header: "" + check_answer_label: "Person 5’s relationship to the lead tenant" + hint_text: "" + question_text: "What is person 5’s relationship to the lead tenant?" + + age5: + page_header: "" + age5_known: + check_answer_label: "" + hint_text: "" + question_text: "Do you know person 5’s age?" + age5: + check_answer_label: "Person 5’s age" + hint_text: "Answer 1 for children aged under 1 year old" + question_text: "Age" + + sex5: + page_header: "" + check_answer_label: "Person 5’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes person 5’s gender identity?" + + ecstat5: + page_header: "" + check_answer_label: "Person 5’s working situation" + hint_text: "" + question_text: "Which of these best describes person 5’s working situation?" + + details_known_6: + page_header: "You’ve given us the details for 5 people in the household" + check_answer_label: "Details known for person 6" + hint_text: "You must provide details for everyone in the household if you know them." + question_text: "Do you know details for person 6?" + + relat6: + page_header: "" + check_answer_label: "Person 6’s relationship to the lead tenant" + hint_text: "" + question_text: "What is person 6’s relationship to the lead tenant?" + + age6: + page_header: "" + age6_known: + check_answer_label: "" + hint_text: "" + question_text: "Do you know person 6’s age?" + age6: + check_answer_label: "Person 6’s age" + hint_text: "Answer 1 for children aged under 1 year old" + question_text: "Age" + + sex6: + page_header: "" + check_answer_label: "Person 6’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes person 6’s gender identity?" + + ecstat6: + page_header: "" + check_answer_label: "Person 6’s working situation" + hint_text: "" + question_text: "Which of these best describes person 6’s working situation?" + + details_known_7: + page_header: "You’ve given us the details for 6 people in the household" + check_answer_label: "Details known for person 7" + hint_text: "You must provide details for everyone in the household if you know them." + question_text: "Do you know details for person 7?" + + relat7: + page_header: "" + check_answer_label: "Person 7’s relationship to the lead tenant" + hint_text: "" + question_text: "What is person 7’s relationship to the lead tenant?" + + age7: + page_header: "" + age7_known: + check_answer_label: "" + hint_text: "" + question_text: "Do you know person 7’s age?" + age7: + check_answer_label: "Person 7’s age" + hint_text: "Answer 1 for children aged under 1 year old" + question_text: "Age" + + sex7: + page_header: "" + check_answer_label: "Person 7’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes person 7’s gender identity?" + + ecstat7: + page_header: "" + check_answer_label: "Person 7’s working situation" + hint_text: "" + question_text: "Which of these best describes person 7’s working situation?" + + details_known_8: + page_header: "You’ve given us the details for 7 people in the household" + check_answer_label: "Details known for person 8" + hint_text: "You must provide details for everyone in the household if you know them." + question_text: "Do you know details for person 8?" + + relat8: + page_header: "" + check_answer_label: "Person 8’s relationship to the lead tenant" + hint_text: "" + question_text: "What is person 8’s relationship to the lead tenant?" + + age8: + page_header: "" + age8_known: + check_answer_label: "" + hint_text: "" + question_text: "Do you know person 8’s age?" + age8: + check_answer_label: "Person 8’s age" + hint_text: "Answer 1 for children aged under 1 year old" + question_text: "Age" + + sex8: + page_header: "" + check_answer_label: "Person 8’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes person 8’s gender identity?" + + ecstat8: + page_header: "" + check_answer_label: "Person 8’s working situation" + hint_text: "" + question_text: "Which of these best describes person 8’s working situation?" diff --git a/config/locales/forms/2025/lettings/household_needs.en.yml b/config/locales/forms/2025/lettings/household_needs.en.yml new file mode 100644 index 000000000..ba63f2031 --- /dev/null +++ b/config/locales/forms/2025/lettings/household_needs.en.yml @@ -0,0 +1,57 @@ +en: + forms: + 2025: + lettings: + household_needs: + armedforces: + page_header: "" + check_answer_label: "Household links to UK armed forces" + hint_text: "This excludes national service.

If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner." + question_text: "Does anybody in the household have any links to the UK armed forces?" + + leftreg: + page_header: "" + check_answer_label: "Person still serving in UK armed forces" + hint_text: "" + question_text: "Is the person still serving in the UK armed forces?" + + reservist: + page_header: "" + check_answer_label: "Person seriously injured or ill as result of serving in UK armed forces" + hint_text: "" + question_text: "Was the person seriously injured or ill as a result of serving in the UK armed forces?" + + preg_occ: + page_header: "" + check_answer_label: "Anybody in household pregnant" + hint_text: "" + question_text: "Is anybody in the household pregnant?" + + housingneeds: + page_header: "" + check_answer_label: "Anybody with disabled access needs" + hint_text: "" + question_text: "Does anybody in the household have any disabled access needs?" + + housingneeds_type: + page_header: "Disabled access needs" + housingneeds_type: + check_answer_label: "Disabled access needs" + hint_text: "" + question_text: "What type of access needs do they have?" + housingneeds_other: + check_answer_label: "Other disabled access needs" + hint_text: "" + question_text: "Do they have any other disabled access needs?" + + illness: + page_header: "" + check_answer_label: "Anybody in household with physical or mental health condition" + hint_text: "" + question_text: "Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?" + + condition_effects: + page_header: "" + check_answer_label: "How is person affected by condition or illness" + hint_text: "Select all that apply." + question_text: "How is the person affected by their condition or illness?" diff --git a/config/locales/forms/2025/lettings/household_situation.en.yml b/config/locales/forms/2025/lettings/household_situation.en.yml new file mode 100644 index 000000000..2b72c45d0 --- /dev/null +++ b/config/locales/forms/2025/lettings/household_situation.en.yml @@ -0,0 +1,120 @@ +en: + forms: + 2025: + lettings: + household_situation: + layear: + page_header: "" + check_answer_label: "Length of time in local authority area" + hint_text: "" + question_text: "How long has the household continuously lived in the local authority area of the new letting?" + + waityear: + page_header: "" + check_answer_label: "Length of time on local authority waiting list" + hint_text: "" + question_text: "How long has the household been on the local authority waiting list for the area of the new letting?" + + reason: + reason_for_leaving_last_settled_home_renewal: + page_header: "" + reason: + check_answer_label: "Reason for leaving last settled home" + hint_text: "You told us this letting is a renewal. We have removed some options because of this." + question_text: "What is the tenant’s main reason for the household leaving their last settled home?" + reasonother: + check_answer_label: "Length of time on local authority waiting list" + hint_text: "" + question_text: "How long has the household been on the local authority waiting list for the area of the new letting?" + reason_for_leaving_last_settled_home: + page_header: "" + reason: + check_answer_label: "Reason for leaving last settled home" + hint_text: "The tenant’s ‘last settled home’ is their last long-standing home. For tenants who were in temporary accommodation, sleeping rough or otherwise homeless, their last settled home is where they were living previously." + question_text: "What is the tenant’s main reason for the household leaving their last settled home?" + reasonother: + check_answer_label: "" + hint_text: "" + question_text: "What is the reason?" + + prevten: + renewal: + page_header: "" + check_answer_label: "Where was the household immediately before this letting?" + hint_text: "You told us this letting is a renewal. We have removed some options because of this.

This is where the household was the night before they moved into this new let." + question_text: "Where was the household immediately before this letting?" + not_renewal: + page_header: "" + check_answer_label: "Where was the household immediately before this letting?" + hint_text: "This is where the household was the night before they moved into this new let." + question_text: "Where was the household immediately before this letting?" + + homeless: + page_header: "" + check_answer_label: "Household homeless immediately before letting" + hint_text: "" + question_text: "Did the household experience homelessness immediately before this letting?" + + previous_postcode: + page_header: "" + ppcodenk: + check_answer_label: "" + hint_text: "This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless." + question_text: "Do you know the postcode of the household’s last settled accommodation?" + ppostcode_full: + check_answer_label: "Postcode of household’s last settled accommodation" + hint_text: "" + question_text: "Postcode for the previous accommodation" + + previous_local_authority: + page_header: "" + previous_la_known: + check_answer_label: "" + hint_text: "This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless." + question_text: "Do you know the local authority of the household’s last settled accommodation?" + prevloc: + check_answer_label: "Location of household’s last settled accommodation" + hint_text: "Select ‘Northern Ireland’, ‘Scotland’, ‘Wales’ or ‘Outside the UK’ if the household’s last settled home was outside England." + question_text: "Select a local authority" + + reasonpref: + page_header: "" + check_answer_label: "Household given reasonable preference" + hint_text: "Households may be given ‘reasonable preference’ for social housing under one or more specific categories by the local authority. This is also known as ‘priority need’." + question_text: "Was the household given ‘reasonable preference’ by the local authority?" + + reasonable_preference_reason: + page_header: "" + check_answer_label: "Reason for reasonable preference" + hint_text: "Select all that apply." + question_text: "Why was the household given ‘reasonable preference’?" + + letting_allocation: + page_header: "" + check_answer_label: "Allocation system" + hint_text: "Select all that apply." + question_text: "How was this letting allocated?" + + referral: + supported_housing: + prp: + page_header: "" + check_answer_label: "Source of referral for letting" + hint_text: "" + question_text: "What was the source of referral for this letting?" + la: + page_header: "" + check_answer_label: "Source of referral for letting" + hint_text: "You told us that you are a local authority. We have removed some options because of this." + question_text: "What was the source of referral for this letting?" + general_needs: + prp: + page_header: "" + check_answer_label: "Source of referral for letting" + hint_text: "You told us that the needs type is general needs. We have removed some options because of this." + question_text: "What was the source of referral for this letting?" + la: + page_header: "" + check_answer_label: "Source of referral for letting" + hint_text: "You told us that you are a local authority and that the needs type is general needs. We have removed some options because of this." + question_text: "What was the source of referral for this letting?" diff --git a/config/locales/forms/2025/lettings/income_and_benefits.en.yml b/config/locales/forms/2025/lettings/income_and_benefits.en.yml new file mode 100644 index 000000000..55e193ff7 --- /dev/null +++ b/config/locales/forms/2025/lettings/income_and_benefits.en.yml @@ -0,0 +1,108 @@ +en: + forms: + 2025: + lettings: + income_and_benefits: + net_income_known: + page_header: "Household’s combined income after tax" + check_answer_label: "Do you know the household’s combined total income after tax?" + hint_text: "" + question_text: "Do you know the household’s combined income after tax?" + + income_amount: + page_header: "Total household income" + incfreq: + check_answer_label: "How often does the household receive this amount?" + hint_text: "" + question_text: "How often does the household receive this amount?" + earnings: + check_answer_label: "Total household income" + hint_text: "" + question_text: "How much income does the household have in total?" + + hb: + page_header: "" + check_answer_label: "Housing-related benefits received" + hint_text: "This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive." + question_text: "Is the household likely to be receiving any of these housing-related benefits?" + + benefits: + page_header: "" + check_answer_label: "Household income from Universal Credit, state pension or benefit" + hint_text: "This excludes child and housing benefit, council tax support and tax credits." + question_text: "How much of the household’s income is from Universal Credit, state pensions or benefits?" + + household_charge: + page_header: "" + check_answer_label: "Does the household pay rent or charges" + hint_text: "If rent is charged on the property then answer Yes to this question, even if the tenants do not pay it themselves." + question_text: "Does the household pay rent or other charges for the accommodation?" + + period: + page_header: "" + check_answer_label: "Frequency of household rent and charges" + hint_text: "Select how often the household is charged. This may be different to how often they pay." + question_text: "How often does the household pay rent and other charges?" + + care_home: + page_header: "" + is_carehome: + check_answer_label: "Care home accommodation" + hint_text: "" + question_text: "Is this accommodation a care home?" + chcharge_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every week?" + chcharge_bi_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every 2 weeks?" + chcharge_4_weekly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every 4 weeks?" + chcharge_monthly: + check_answer_label: "Care home charges" + hint_text: "" + question_text: "How much does the household pay every month?" + + rent_and_charges: + page_header: "Household rent and charges" + brent: + check_answer_label: "Basic rent" + hint_text: "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent." + question_text: "What is the basic rent?" + scharge: + check_answer_label: "Service charge" + hint_text: "For example, for cleaning. Households may receive housing benefit or Universal Credit towards the service charge." + question_text: "What is the service charge?" + pscharge: + check_answer_label: "Personal service charge" + hint_text: "For example, for heating or hot water. This doesn’t include housing benefit or Universal Credit." + question_text: "What is the personal service charge?" + supcharg: + check_answer_label: "Support charge" + hint_text: "Any charges made to fund support services included in tenancy agreement." + question_text: "What is the support charge?" + tcharge: + check_answer_label: "Household rent and charges" + hint_text: "This is the total for rent and all charges." + question_text: "Total charge" + + hbrentshortfall: + page_header: "" + check_answer_label: "Any outstanding amount for basic rent and charges" + hint_text: "Also known as the ‘outstanding amount’." + question_text: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?" + + outstanding_amount: + page_header: "" + tshortfall_known: + check_answer_label: "Do you know the outstanding amount?" + hint_text: "You only need to give an approximate figure." + question_text: "Can you estimate the outstanding amount?" + tshortfall: + check_answer_label: "Estimated outstanding amountt" + hint_text: "Also known as the ‘outstanding amount’." + question_text: "Estimated outstanding amount" diff --git a/config/locales/forms/2025/lettings/property_information.en.yml b/config/locales/forms/2025/lettings/property_information.en.yml new file mode 100644 index 000000000..bf3f3532c --- /dev/null +++ b/config/locales/forms/2025/lettings/property_information.en.yml @@ -0,0 +1,127 @@ +en: + forms: + 2025: + lettings: + property_information: + first_time_property_let_as_social_housing: + page_header: "" + check_answer_label: "First time being let as social-housing?" + hint_text: "" + question_text: "Is this the first time the property has been let as social housing?" + + uprn: + page_header: "" + uprn_known: + check_answer_label: "UPRN known?" + hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

The UPRN may not be the same as the property reference assigned by your organisation.

If you don’t know the UPRN you can enter the address of the property instead on the next screen." + question_text: "Do you know the property's UPRN?" + uprn: + check_answer_label: "UPRN" + hint_text: "" + question_text: "What is the property's UPRN?" + + uprn_confirmed: + page_header: "We found an address that might be this property" + check_answer_label: "Is this the right address?" + hint_text: "" + question_text: "Is this the property address?" + + address_matcher: + page_header: "Find an address" + address_line1_input: + check_answer_label: "Find address" + hint_text: "" + question_text: "Address line 1" + postcode_full_input: + check_answer_label: "" + hint_text: "" + question_text: "Postcode" + + uprn_selection: + page_header: "We found an address that might be this property" + check_answer_label: "Select the correct address" + hint_text: "" + question_text: "Select the correct address" + + address: + page_header: "Q12 - What is the property's address?" + address_line1: + check_answer_label: "Address lines 1 and 2" + hint_text: "" + question_text: "Address line 1" + address_line2: + check_answer_label: "" + hint_text: "" + question_text: "Address line 2 (optional)" + town_or_city: + check_answer_label: "Town or city" + hint_text: "" + question_text: "Town or city" + county: + check_answer_label: "County" + hint_text: "" + question_text: "County (optional)" + postcode_full: + check_answer_label: "Postcode" + hint_text: "" + question_text: "Postcode" + + la: + page_header: "" + check_answer_label: "Local authority" + hint_text: "" + question_text: "What is the property’s local authority?" + + + unitletas: + page_header: "" + check_answer_label: "Most recent let type" + hint_text: "This is the rent type of the previous tenancy in this property." + question_text: "What type was the property most recently let as?" + + rsnvac: + page_header: "" + check_answer_label: "Vacancy reason" + hint_text: "" + question_text: "What is the reason for the property being vacant?" + + unittype_gn: + page_header: "" + check_answer_label: "Type of unit" + hint_text: "" + question_text: "What type of unit is the property?" + + builtype: + page_header: "" + check_answer_label: "Type of building" + hint_text: "" + question_text: "What type of building is the property?" + + wchair: + page_header: "" + check_answer_label: "Property built or adapted to wheelchair-user standards" + hint_text: "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." + question_text: "Is the property built or adapted to wheelchair-user standards?" + + beds: + page_header: "" + check_answer_label: "Number of bedrooms" + hint_text: "If shared accommodation, enter the number of bedrooms occupied by this household." + question_text: "How many bedrooms does the property have?" + + voiddate: + page_header: "Void date" + check_answer_label: "Void date" + hint_text: "" + question_text: "What is the void date?" + + property_major_repairs: + page_header: "" + majorrepairs: + check_answer_label: "Major repairs carried out during void period" + hint_text: "Major repairs are works that could not be reasonably carried out with a tenant living at the property. For example, structural repairs." + question_text: "Were any major repairs carried out during the void period?" + mrcdate: + check_answer_label: "Completion date of repairs" + hint_text: "" + question_text: "When were the repairs completed?" diff --git a/config/locales/forms/2025/lettings/setup.en.yml b/config/locales/forms/2025/lettings/setup.en.yml new file mode 100644 index 000000000..029b5e91e --- /dev/null +++ b/config/locales/forms/2025/lettings/setup.en.yml @@ -0,0 +1,87 @@ +en: + forms: + 2025: + lettings: + setup: + owning_organisation_id: + page_header: "" + check_answer_label: "Stock owner" + hint_text: "" + question_text: "Which organisation owns this property?" + + managing_organisation_id: + page_header: "" + check_answer_label: "Managing agent" + hint_text: "" + question_text: "Which organisation manages this letting?" + + assigned_to_id: + page_header: "" + check_answer_label: "Log owner" + hint_text: "" + question_text: "Which user are you creating this log for?" + + needstype: + page_header: "" + check_answer_label: "Needs type" + hint_text: "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes." + question_text: "What is the needs type?" + + scheme_id: + page_header: "Scheme" + check_answer_label: "Scheme name" + hint_text: "Enter postcode or scheme name.

A supported housing scheme provides shared or self-contained housing for a particular client group, for example younger or vulnerable people." + question_text: "What scheme is this log for?" + + location_id: + less_than_twenty: + page_header: "Location" + check_answer_label: "Location" + hint_text: "" + question_text: "Which location is this letting for?" + twenty_or_more: + page_header: "Location" + check_answer_label: "Location" + hint_text: '
This scheme has 20 or more locations.
Enter postcode or address.' + question_text: "Which location is this letting for?" + + renewal: + page_header: "" + check_answer_label: "Property renewal" + hint_text: "If the property was previously being used as temporary accommodation, then answer 'no'." + question_text: "Is this letting a renewal of social housing to the same tenant in the same property?" + + startdate: + page_header: "" + check_answer_label: "Tenancy start date" + hint_text: "" + question_text: "What is the tenancy start date?" + + rent_type: + page_header: "Rent Type" + rent_type: + check_answer_label: "Rent type" + hint_text: "" + question_text: "What is the rent type?" + irproduct_other: + check_answer_label: "Product name" + hint_text: "" + question_text: "Name of rent product" + + tenancycode: + page_header: "" + check_answer_label: "Tenant code" + hint_text: "This is how you usually refer to this tenancy on your own systems." + question_text: "What is the tenant code?" + + propcode: + page_header: "" + check_answer_label: "Property reference" + hint_text: "This is how you usually refer to this property on your own systems." + question_text: "What is the property reference?" + + declaration: + page_header: "Ministry of Housing, Communities and Local Government privacy notice" + check_answer_label: "Tenant has seen the privacy notice" + hint_text: "" + question_text: "Declaration" diff --git a/config/locales/forms/2025/lettings/tenancy_information.en.yml b/config/locales/forms/2025/lettings/tenancy_information.en.yml new file mode 100644 index 000000000..3276d1b3d --- /dev/null +++ b/config/locales/forms/2025/lettings/tenancy_information.en.yml @@ -0,0 +1,66 @@ +en: + forms: + 2025: + lettings: + tenancy_information: + joint: + page_header: "" + check_answer_label: "Is this a joint tenancy?" + hint_text: "This is where two or more people are named on the tenancy agreement" + question_text: "Is this a joint tenancy?" + + startertenancy: + page_header: "" + check_answer_label: "Is this a starter or introductory tenancy?" + hint_text: "If the tenancy has an ‘introductory period’ answer ‘yes’.

You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy." + question_text: "Is this a starter tenancy?" + + tenancy: + tenancy_type: + page_header: "" + tenancy: + check_answer_label: "Type of main tenancy" + hint_text: "" + question_text: "What is the type of tenancy?" + tenancyother: + check_answer_label: "" + hint_text: "" + question_text: "Please state the tenancy type" + starter_tenancy_type: + page_header: "" + tenancy: + check_answer_label: "Type of main tenancy after the starter or introductory period has ended" + hint_text: "" + question_text: "What is the type of tenancy after the starter or introductory period has ended?" + tenancyother: + check_answer_label: "" + hint_text: "" + question_text: "Please state the tenancy type" + + tenancylength: + tenancy_length: + page_header: "" + check_answer_label: "Length of fixed-term tenancy" + hint_text: "Do not include the starter or introductory period." + question_text: "What is the length of the fixed-term tenancy to the nearest year?" + tenancy_length_affordable_rent: + page_header: "" + check_answer_label: "Length of fixed-term tenancy" + hint_text: "Do not include the starter or introductory period.
The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years." + question_text: "What is the length of the fixed-term tenancy to the nearest year?" + tenancy_length_intermediate_rent: + page_header: "" + check_answer_label: "Length of fixed-term tenancy" + hint_text: "Do not include the starter or introductory period.
The minimum period is 1 year for intermediate rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 1 year." + question_text: "What is the length of the fixed-term tenancy to the nearest year?" + tenancy_length_periodic: + page_header: "" + check_answer_label: "Length of periodic tenancy" + hint_text: "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue" + question_text: "What is the length of the periodic tenancy to the nearest year?" + + sheltered: + page_header: "" + check_answer_label: "Is this letting in sheltered accommodation?" + hint_text: "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.

Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission." + question_text: "Is this letting in sheltered accommodation?" diff --git a/config/locales/forms/2025/sales/guidance.en.yml b/config/locales/forms/2025/sales/guidance.en.yml new file mode 100644 index 000000000..4ed6796b3 --- /dev/null +++ b/config/locales/forms/2025/sales/guidance.en.yml @@ -0,0 +1,46 @@ +en: + forms: + 2025: + sales: + guidance: + shared_ownership_type_definitions: + title: "Shared Ownership Type Definitions" + content: "

Shared Ownership (old model lease): Cannot be used for homes funded through the Affordable Homes Programme 2021 to 2026. Use the new model lease for these properties.

+

Shared Ownership (new model lease): Homes bought using the Affordable Homes Programme 2021 to 2026.

+

Social HomeBuy — shared ownership purchase: Tenants of private registered providers purchase their home at discount on Shared Ownership terms.

+

Home Ownership for people with Long-Term Disabilities (HOLD): A shared ownership sale for those with long term disabilities.

+

Older Persons Shared Ownership: A type of shared ownership for those 55 years and over.

+

Rent to Buy — Shared Ownership: A sale following a period of discounted rent.

+

Right to Shared Ownership (RtSO): A sale of a share of a rented home to a tenant using this scheme.

+

London Living Rent — Shared Ownership: A shared ownership sale following a period of discounted rent as part of the London Living Rent scheme.

" + + discounted_ownership_type_definitions: + title: "Discounted Ownership Type Definitions" + content: "

Right to Acquire (RTA): a discounted sale of a property built or purchased after 31 March 1997 to tenants of a private registered provider.

+

Preserved Right to Buy (PRTB): a discounted sale of a property that used to be owned by a council to tenants of a private registered provider.

+

Voluntary Right to Buy (VRTB): a discounted sale to tenants in this PRP owned property, as part of a pilot scheme.

+

Right to Buy (RTB): a discounted sale to tenants in this council owned property.

+

Rent to Buy full ownership: a sale on full ownership terms following a period of discounted rent.

+

Social HomeBuy for outright purchase: a discounted sale to tenants of a private registered provider on full ownership terms.

+

Any other equity loan scheme: any scheme, not covered elsewhere, in which a loan is used to purchase equity.

" + + mortgage_lender: + title: "Can’t find the mortgage lender you’re looking for?" + content: "
    +
  • Double check the spelling and try again
  • +
  • Type the first few letters to see the suggestions
  • +
  • Type Other and continue - we’ll ask you to type in your answer in the next question
  • +
" + + outright_sale_type_definitions: + title: "Outright sale type definitions" + content: "

Outright sale: the full purchase of a property, usually with a mortgage or cash.

+

Other sale: any sale which does not fit the criteria of any of the remaining options.

" + + privacy_notice_buyer_joint_purchase: + content: "Make sure the buyers have seen or been given access to %{privacy_notice_link} before completing this log. This is a legal requirement under data protection legislation." + privacy_notice_link_text: "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice" + + privacy_notice_buyer: + content: "Make sure the buyer has seen or been given access to %{privacy_notice_link} before completing this log. This is a legal requirement under data protection legislation." + privacy_notice_link_text: "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice" diff --git a/config/locales/forms/2025/sales/household_characteristics.en.yml b/config/locales/forms/2025/sales/household_characteristics.en.yml new file mode 100644 index 000000000..b92cba2de --- /dev/null +++ b/config/locales/forms/2025/sales/household_characteristics.en.yml @@ -0,0 +1,345 @@ +en: + forms: + 2025: + sales: + household_characteristics: + age1: + page_header: "" + age1_known: + check_answer_label: "Buyer 1’s age" + hint_text: "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + question_text: "Do you know buyer 1’s age?" + age1: + check_answer_label: "Buyer 1’s age" + hint_text: "" + question_text: "Age" + + sex1: + page_header: "" + check_answer_label: "Buyer 1’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes buyer 1’s gender identity?" + + ethnic_group: + page_header: "" + check_answer_label: "Buyer 1’s ethnic group" + hint_text: "" + question_text: "What is buyer 1’s ethnic group?" + + ethnic: + ethnic_background_black: + page_header: "" + check_answer_label: "Buyer 1’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 1’s Black, African, Caribbean or Black British background?" + ethnic_background_asian: + page_header: "" + check_answer_label: "Buyer 1’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 1’s Asian or Asian British background?" + ethnic_background_arab: + page_header: "" + check_answer_label: "Buyer 1’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 1’s Arab background?" + ethnic_background_mixed: + page_header: "" + check_answer_label: "Buyer 1’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 1’s Mixed or Multiple ethnic groups background?" + ethnic_background_white: + page_header: "" + check_answer_label: "Buyer 1’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 1’s White background?" + + nationality_all_group: + page_header: "" + check_answer_label: "Buyer 1’s nationality" + hint_text: "If buyer 1 is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the buyer should decide which country to enter." + question_text: "What is buyer 1’s nationality?" + + nationality_all: + page_header: "" + check_answer_label: "Buyer 1’s nationality" + hint_text: "" + question_text: "Enter a nationality" + + ecstat1: + page_header: "" + check_answer_label: "Buyer 1's working situation" + hint_text: "" + question_text: "Which of these best describes buyer 1's working situation?" + + buy1livein: + page_header: "" + check_answer_label: "Will buyer 1 live in the property?" + hint_text: "" + question_text: "Will buyer 1 live in the property?" + + relat2: + buyer: + page_header: "" + check_answer_label: "Buyer 2's relationship to buyer 1" + hint_text: "" + question_text: "What is buyer 2's relationship to buyer 1?" + person: + page_header: "" + check_answer_label: "Person 2’s relationship to Buyer 1" + hint_text: "" + question_text: "What is Person 2’s relationship to Buyer 1?" + + age2: + buyer: + page_header: "" + age2_known: + check_answer_label: "Buyer 2’s age" + hint_text: "" + question_text: "Do you know buyer 2’s age?" + age2: + check_answer_label: "Buyer 2’s age" + hint_text: "" + question_text: "Age" + person: + page_header: "" + age2_known: + check_answer_label: "Person 2’s age known?" + hint_text: "" + question_text: "Do you know person 2’s age?" + age2: + check_answer_label: "Person 2’s age" + hint_text: "" + question_text: "Age" + + sex2: + buyer: + page_header: "" + check_answer_label: "Buyer 2’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes buyer 2’s gender identity?" + person: + page_header: "" + check_answer_label: "Person 2’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes Person 2’s gender identity?" + + ethnic_group2: + page_header: "" + check_answer_label: "Buyer 2’s ethnic group" + hint_text: "" + question_text: "What is buyer 2’s ethnic group?" + + ethnicbuy2: + ethnic_background_black: + page_header: "" + check_answer_label: "Buyer 2’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 2’s Black, African, Caribbean or Black British background?" + ethnic_background_asian: + page_header: "" + check_answer_label: "Buyer 2’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 2’s Asian or Asian British background?" + ethnic_background_arab: + page_header: "" + check_answer_label: "Buyer 2’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 2’s Arab background?" + ethnic_background_mixed: + page_header: "" + check_answer_label: "Buyer 2’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 2’s Mixed or Multiple ethnic groups background?" + ethnic_background_white: + page_header: "" + check_answer_label: "Buyer 2’s ethnic background" + hint_text: "" + question_text: "Which of the following best describes buyer 2’s White background?" + + nationality_all_buyer2_group: + page_header: "" + check_answer_label: "Buyer 2’s nationality" + hint_text: "If buyer 1 is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the buyer should decide which country to enter." + question_text: "What is buyer 2’s nationality?" + + nationality_all_buyer2: + page_header: "" + check_answer_label: "Buyer 2’s nationality" + hint_text: "" + question_text: "Enter a nationality" + + ecstat2: + buyer: + page_header: "" + check_answer_label: "Buyer 2's working situation" + hint_text: "" + question_text: "Which of these best describes buyer 2's working situation?" + person: + page_header: "" + check_answer_label: "Person 2’s working situation" + hint_text: "" + question_text: "Which of these best describes Person 2’s working situation?" + + buy2livein: + page_header: "" + check_answer_label: "Will buyer 2 live in the property?" + hint_text: "" + question_text: "Will buyer 2 live in the property?" + + hholdcount: + joint_purchase: + page_header: "" + check_answer_label: "Number of other people living in the property" + hint_text: "You can provide details for a maximum of 4 other people for a joint purchase." + question_text: "Besides the buyers, how many other people live or will live in the property?" + not_joint_purchase: + page_header: "" + check_answer_label: "Number of other people living in the property" + hint_text: "You can provide details for a maximum of 5 other people if there is only one buyer." + question_text: "Besides the buyer, how many other people live or will live in the property?" + + details_known_2: + page_header: "" + check_answer_label: "Details known for person 2?" + hint_text: "" + question_text: "Do you know the details for person 2?" + + details_known_3: + page_header: "" + check_answer_label: "Details known for person 3?" + hint_text: "" + question_text: "Do you know the details for person 3?" + + relat3: + page_header: "" + check_answer_label: "Person 3’s relationship to Buyer 1" + hint_text: "" + question_text: "What is Person 3’s relationship to Buyer 1?" + + age3: + page_header: "" + age3_known: + check_answer_label: "Person 3’s age known?" + hint_text: "" + question_text: "Do you know person 3’s age?" + age3: + check_answer_label: "Person 3’s age" + hint_text: "" + question_text: "Age" + + sex3: + page_header: "" + check_answer_label: "Person 3’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes Person 3’s gender identity?" + + ecstat3: + page_header: "" + check_answer_label: "Person 3’s working situation" + hint_text: "" + question_text: "Which of these best describes Person 3’s working situation?" + + details_known_4: + page_header: "" + check_answer_label: "Details known for person 4?" + hint_text: "" + question_text: "Do you know the details for person 4?" + + relat4: + page_header: "" + check_answer_label: "Person 4’s relationship to Buyer 1" + hint_text: "" + question_text: "What is Person 4’s relationship to Buyer 1?" + + age4: + page_header: "" + age4_known: + check_answer_label: "Person 4’s age known?" + hint_text: "" + question_text: "Do you know person 4’s age?" + age4: + check_answer_label: "Person 4’s age" + hint_text: "" + question_text: "Age" + + sex4: + page_header: "" + check_answer_label: "Person 4’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes Person 4’s gender identity?" + + ecstat4: + page_header: "" + check_answer_label: "Person 4’s working situation" + hint_text: "" + question_text: "Which of these best describes Person 4’s working situation?" + + details_known_5: + page_header: "" + check_answer_label: "Details known for person 5?" + hint_text: "" + question_text: "Do you know the details for person 5?" + + relat5: + page_header: "" + check_answer_label: "Person 5’s relationship to Buyer 1" + hint_text: "" + question_text: "What is Person 5’s relationship to Buyer 1?" + + age5: + page_header: "" + age5_known: + check_answer_label: "Person 5’s age known?" + hint_text: "" + question_text: "Do you know person 5’s age?" + age5: + check_answer_label: "Person 5’s age" + hint_text: "" + question_text: "Age" + + sex5: + page_header: "" + check_answer_label: "Person 5’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes Person 5’s gender identity?" + + ecstat5: + page_header: "" + check_answer_label: "Person 5’s working situation" + hint_text: "" + question_text: "Which of these best describes Person 5’s working situation?" + + details_known_6: + page_header: "" + check_answer_label: "Details known for person 6?" + hint_text: "" + question_text: "Do you know the details for person 6?" + + relat6: + page_header: "" + check_answer_label: "Person 6’s relationship to Buyer 1" + hint_text: "" + question_text: "What is Person 6’s relationship to Buyer 1?" + + age6: + page_header: "" + age6_known: + check_answer_label: "Person 6’s age known?" + hint_text: "" + question_text: "Do you know person 6’s age?" + age6: + check_answer_label: "Person 6’s age" + hint_text: "" + question_text: "Age" + + sex6: + page_header: "" + check_answer_label: "Person 6’s gender identity" + hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." + question_text: "Which of these best describes Person 6’s gender identity?" + + ecstat6: + page_header: "" + check_answer_label: "Person 6’s working situation" + hint_text: "" + question_text: "Which of these best describes Person 6’s working situation?" diff --git a/config/locales/forms/2025/sales/household_needs.en.yml b/config/locales/forms/2025/sales/household_needs.en.yml new file mode 100644 index 000000000..1908ba6ca --- /dev/null +++ b/config/locales/forms/2025/sales/household_needs.en.yml @@ -0,0 +1,34 @@ +en: + forms: + 2025: + sales: + household_needs: + hhregres: + page_header: "" + check_answer_label: "Have any of the buyers ever served as a regular in the UK armed forces?" + hint_text: "A regular is somebody who has served in the Royal Navy, the Royal Marines, the Royal Airforce or Army full time and does not include reserve forces" + question_text: "Have any of the buyers ever served as a regular in the UK armed forces?" + + hhregresstill: + page_header: "" + check_answer_label: "Are they still serving in the UK armed forces?" + hint_text: "" + question_text: "Is the buyer still serving in the UK armed forces?" + + armedforcesspouse: + page_header: "" + check_answer_label: "Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?" + hint_text: "" + question_text: "Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?" + + disabled: + page_header: "" + check_answer_label: "Does anyone in the household have a disability?" + hint_text: "This includes any long-term health condition that has an impact on the person's day-to-day life" + question_text: "Does anyone in the household consider themselves to have a disability?" + + wheel: + page_header: "" + check_answer_label: "Does anyone in the household use a wheelchair?" + hint_text: "This can be inside or outside the home" + question_text: "Does anyone in the household use a wheelchair?" diff --git a/config/locales/forms/2025/sales/household_situation.en.yml b/config/locales/forms/2025/sales/household_situation.en.yml new file mode 100644 index 000000000..3aa3545d8 --- /dev/null +++ b/config/locales/forms/2025/sales/household_situation.en.yml @@ -0,0 +1,50 @@ +en: + forms: + 2025: + sales: + household_situation: + prevten: + page_header: "" + check_answer_label: "Buyer 1’s previous tenure" + hint_text: "" + question_text: "What was buyer 1’s previous tenure?" + + last_accommodation: + page_header: "" + ppcodenk: + check_answer_label: "Buyer 1’s last settled accommodation" + hint_text: "This is also known as the household’s 'last settled home'" + question_text: "Do you know the postcode of buyer 1’s last settled accommodation?" + ppostcode_full: + check_answer_label: "Postcode of buyer 1’s last settled accommodation" + hint_text: "" + question_text: "Postcode" + + last_accommodation_la: + page_header: "" + previous_la_known: + check_answer_label: "Local authority of buyer 1’s last settled accommodation" + hint_text: "This is also known as the household’s 'last settled home'" + question_text: "Do you know the local authority of buyer 1’s last settled accommodation?" + prevloc: + check_answer_label: "Local authority of buyer 1’s last settled accommodation" + hint_text: "" + question_text: "Select a local authority" + + buyers_organisations: + page_header: "" + check_answer_label: "Organisations buyers were registered with" + hint_text: "Select all that apply. This question is optional. If no options are applicable, leave the options blank, and select save and continue." + question_text: "What organisations were the buyers registered with?" + + buy2living: + page_header: "" + check_answer_label: "Buyer 2 living at the same address" + hint_text: "" + question_text: "At the time of purchase, was buyer 2 living at the same address as buyer 1?" + + prevtenbuy2: + page_header: "" + check_answer_label: "Buyer 2’s previous tenure" + hint_text: "" + question_text: "What was buyer 2’s previous tenure?" diff --git a/config/locales/forms/2025/sales/income_benefits_and_savings.en.yml b/config/locales/forms/2025/sales/income_benefits_and_savings.en.yml new file mode 100644 index 000000000..20beb0b85 --- /dev/null +++ b/config/locales/forms/2025/sales/income_benefits_and_savings.en.yml @@ -0,0 +1,90 @@ +en: + forms: + 2025: + sales: + income_benefits_and_savings: + buyer_1_income: + page_header: "" + income1nk: + check_answer_label: "Buyer 1’s gross annual income known?" + hint_text: "" + question_text: "Do you know buyer 1’s annual income?" + income1: + check_answer_label: "Buyer 1’s gross annual income" + hint_text: "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments." + question_text: "Buyer 1’s gross annual income" + + inc1mort: + page_header: "" + check_answer_label: "Buyer 1’s income used for mortgage application" + hint_text: "" + question_text: "Was buyer 1’s income used for a mortgage application?" + + buyer_2_income: + page_header: "" + income2nk: + check_answer_label: "Buyer 2’s gross annual income known?" + hint_text: "" + question_text: "Do you know buyer 2’s annual income?" + income2: + check_answer_label: "Buyer 2’s gross annual income" + hint_text: "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments." + question_text: "Buyer 2’s gross annual income" + + inc2mort: + page_header: "" + check_answer_label: "Buyer 2’s income used for mortgage application" + hint_text: "" + question_text: "Was buyer 2’s income used for a mortgage application?" + + housing_benefits: + joint_purchase: + page_header: "" + check_answer_label: "Housing-related benefits buyers received before buying this property" + hint_text: "" + question_text: "Were the buyers receiving any of these housing-related benefits immediately before buying this property?" + not_joint_purchase: + page_header: "" + check_answer_label: "Housing-related benefits buyer received before buying this property" + hint_text: "" + question_text: "Was the buyer receiving any of these housing-related benefits immediately before buying this property?" + + savings: + joint_purchase: + page_header: "" + savingsnk: + check_answer_label: "Buyers’ total savings known?" + hint_text: "" + question_text: "Do you know how much the 'buyers' had in savings before they paid any deposit for the property?" + savings: + check_answer_label: "Buyers’ total savings before any deposit paid" + hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account." + question_text: "Enter their total savings to the nearest £10" + not_joint_purchase: + page_header: "" + savingsnk: + check_answer_label: "Buyer’s total savings known?" + hint_text: "" + question_text: "Do you know how much the buyer had in savings before they paid any deposit for the property?" + savings: + check_answer_label: "Buyer’s total savings before any deposit paid" + hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account." + question_text: "Enter their total savings to the nearest £10" + + prevown: + joint_purchase: + page_header: "" + check_answer_label: "Buyers previously owned a property." + hint_text: "" + question_text: "Have any of the buyers previously owned a property?" + not_joint_purchase: + page_header: "" + check_answer_label: "Buyer previously owned a property." + hint_text: "" + question_text: "Has the buyer previously owned a property?" + + prevshared: + page_header: "" + check_answer_label: "Previous property shared ownership?" + hint_text: "For any buyer" + question_text: "Was the previous property under shared ownership?" diff --git a/config/locales/forms/2025/sales/property_information.en.yml b/config/locales/forms/2025/sales/property_information.en.yml new file mode 100644 index 000000000..240c96f09 --- /dev/null +++ b/config/locales/forms/2025/sales/property_information.en.yml @@ -0,0 +1,91 @@ +en: + forms: + 2025: + sales: + property_information: + uprn: + page_header: "" + uprn_known: + check_answer_label: "UPRN known?" + hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

The UPRN may not be the same as the property reference assigned by your organisation.

If you don’t know the UPRN you can enter the address of the property instead on the next screen." + question_text: "Do you know the property's UPRN?" + uprn: + check_answer_label: "UPRN" + hint_text: "" + question_text: "What is the property's UPRN?" + + uprn_confirmed: + page_header: "We found an address that might be this property" + check_answer_label: "Is this the right address?" + hint_text: "" + question_text: "Is this the property address?" + + address_matcher: + page_header: "Find an address" + address_line1_input: + check_answer_label: "Find address" + hint_text: "" + question_text: "Address line 1" + postcode_full_input: + check_answer_label: "" + hint_text: "" + question_text: "Postcode" + + uprn_selection: + page_header: "We found an address that might be this property" + check_answer_label: "Select the correct address" + hint_text: "" + question_text: "Select the correct address" + + address: + page_header: "Q12 - What is the property's address?" + address_line1: + check_answer_label: "Address lines 1 and 2" + hint_text: "" + question_text: "Address line 1" + address_line2: + check_answer_label: "" + hint_text: "" + question_text: "Address line 2 (optional)" + town_or_city: + check_answer_label: "Town or city" + hint_text: "" + question_text: "Town or city" + county: + check_answer_label: "County" + hint_text: "" + question_text: "County (optional)" + postcode_full: + check_answer_label: "Postcode" + hint_text: "" + question_text: "Postcode" + + la: + page_header: "" + check_answer_label: "Local authority" + hint_text: "" + question_text: "What is the property’s local authority?" + + beds: + page_header: "" + check_answer_label: "Number of bedrooms" + hint_text: "A bedsit has 1 bedroom." + question_text: "How many bedrooms does the property have?" + + proptype: + page_header: "" + check_answer_label: "Type of unit" + hint_text: "" + question_text: "What type of unit is the property?" + + builtype: + page_header: "" + check_answer_label: "Type of building" + hint_text: "" + question_text: "What type of building is the property?" + + wchair: + page_header: "" + check_answer_label: "Property built or adapted to wheelchair-user standards" + hint_text: "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." + question_text: "Is the property built or adapted to wheelchair-user standards?" diff --git a/config/locales/forms/2025/sales/sale_information.en.yml b/config/locales/forms/2025/sales/sale_information.en.yml new file mode 100644 index 000000000..51270a92e --- /dev/null +++ b/config/locales/forms/2025/sales/sale_information.en.yml @@ -0,0 +1,206 @@ +en: + forms: + 2025: + sales: + sale_information: + living_before_purchase: + joint_purchase: + page_header: "" + proplen: + check_answer_label: "Number of years living in the property before purchase" + hint_text: "You should round up to the nearest year" + question_text: "How long did they live there?" + proplen_asked: + check_answer_label: "Buyers lived in the property before purchasing" + hint_text: "" + question_text: "Did the buyers live in the property before purchasing it?" + not_joint_purchase: + page_header: "" + proplen: + check_answer_label: "Number of years living in the property before purchase" + hint_text: "You should round up to the nearest year" + question_text: "How long did they live there?" + proplen_asked: + check_answer_label: "Buyer lived in the property before purchasing" + hint_text: "" + question_text: "Did the buyer live in the property before purchasing it?" + + staircasing: + page_header: "" + check_answer_label: "Staircasing transaction" + hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" + question_text: "Is this a staircasing transaction?" + about_staircasing: + page_header: "About the staircasing transaction" + stairbought: + check_answer_label: "Percentage bought in this staircasing transaction" + hint_text: "" + question_text: "What percentage of the property has been bought in this staircasing transaction?" + stairowned: + joint_purchase: + check_answer_label: "Percentage the buyers now own in total" + hint_text: "" + question_text: "What percentage of the property do the buyers now own in total?" + not_joint_purchase: + check_answer_label: "Percentage the buyer now owns in total" + hint_text: "" + question_text: "What percentage of the property does the buyer now own in total?" + staircasesale: + check_answer_label: "Part of a back-to-back staircasing transaction" + hint_text: "" + question_text: "Is this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?" + + resale: + page_header: "" + check_answer_label: "Is this a resale?" + hint_text: "If the social landlord has previously sold the property to another buyer and is now reselling the property, select 'yes'. If this is the first time the property has been sold, select 'no'." + question_text: "Is this a resale?" + + exchange_date: + page_header: "" + check_answer_label: "Exchange of contracts date" + hint_text: "" + question_text: "What is the exchange of contracts date?" + + handover_date: + page_header: "" + check_answer_label: "Practical completion or handover date" + hint_text: "This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP)" + question_text: "What is the practical completion or handover date?" + + la_nominations: + page_header: "" + check_answer_label: "Household rehoused under a local authority nominations agreement?" + hint_text: "A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing" + question_text: "Was the household rehoused under a 'local authority nominations agreement'?" + + soctenant: + joint_purchase: + page_header: "" + check_answer_label: "Any buyers were registered providers, housing association or local authority tenants immediately before this sale?" + hint_text: "" + question_text: "Were any of the buyers private registered providers, housing association or local authority tenants immediately before this sale?" + not_joint_purchase: + page_header: "" + check_answer_label: "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?" + hint_text: "" + question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" + + frombeds: + page_header: "About the buyers’ previous property" + check_answer_label: "Number of bedrooms in previous property" + hint_text: "For bedsits enter 1" + question_text: "How many bedrooms did the property have?" + + fromprop: + page_header: "" + check_answer_label: "Previous property type" + hint_text: "" + question_text: "What was the previous property type?" + + socprevten: + page_header: "" + check_answer_label: "Previous property tenure" + hint_text: "" + question_text: "What was the previous tenure of the buyer?" + + value: + page_header: "About the price of the property" + check_answer_label: "Full purchase price" + hint_text: "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)" + question_text: "What was the full purchase price?" + + equity: + page_header: "About the price of the property" + check_answer_label: "Initial percentage equity stake" + hint_text: "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" + question_text: "What was the initial percentage equity stake purchased?" + + mortgageused: + page_header: "Mortgage Amount" + check_answer_label: "Mortgage used" + hint_text: "" + question_text: "Was a mortgage used for the purchase of this property?" + + mortgage: + page_header: "Mortgage Amount" + check_answer_label: "Mortgage amount" + hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." + question_text: "What is the mortgage amount?" + + mortgagelender: + page_header: "" + check_answer_label: "Mortgage lender" + hint_text: "" + question_text: "What is the name of the mortgage lender?" + + mortgagelenderother: + page_header: "" + check_answer_label: "Other Mortgage Lender" + hint_text: "" + question_text: "What is the other mortgage lender?" + + mortlen: + page_header: "" + check_answer_label: "Length of mortgage" + hint_text: "You should round up to the nearest year. Value should not exceed 60 years." + question_text: "What is the length of the mortgage?" + + extrabor: + page_header: "" + check_answer_label: "Any other borrowing?" + hint_text: "" + question_text: "Does this include any extra borrowing?" + + deposit: + page_header: "About the deposit" + check_answer_label: "Deposit amount" + hint_text: "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage. This excludes any grant or loan. As this is a fully staircased sale this question is optional. If you do not have the information available click save and continue" + question_text: "How much cash deposit was paid on the property?" + + cashdis: + page_header: "About the deposit" + check_answer_label: "Cash discount through SocialHomeBuy" + hint_text: "Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme" + question_text: "How much cash discount was given through Social HomeBuy?" + + mrent: + page_header: "" + check_answer_label: "Monthly rent" + hint_text: "Amount paid before any charges" + question_text: "What is the basic monthly rent?" + + leaseholdcharges: + page_header: "" + has_mscharge: + check_answer_label: "Does the property have any monthly leasehold charges?" + hint_text: "For example, service and management charges" + question_text: "Does the property have any monthly leasehold charges?" + mscharge: + check_answer_label: "Monthly leasehold charges" + hint_text: "" + question_text: "Enter the total monthly charge" + + purchase_price: + discounted_ownership: + page_header: "About the price of the property" + check_answer_label: "Purchase price" + hint_text: "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount" + question_text: "What is the full purchase price?" + outright_sale: + page_header: "About the price of the property" + check_answer_label: "Purchase price" + hint_text: "" + question_text: "What is the full purchase price?" + + discount: + page_header: "About the price of the property" + check_answer_label: "Percentage discount" + hint_text: "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)

If discount capped, enter capped %

If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." + question_text: "What was the percentage discount?" + + grant: + page_header: "About the price of the property" + check_answer_label: "Amount of any loan, grant or subsidy" + hint_text: "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy" + question_text: "What was the amount of any loan, grant, discount or subsidy given?" diff --git a/config/locales/forms/2025/sales/setup.en.yml b/config/locales/forms/2025/sales/setup.en.yml new file mode 100644 index 000000000..4f00ab0c2 --- /dev/null +++ b/config/locales/forms/2025/sales/setup.en.yml @@ -0,0 +1,110 @@ +en: + forms: + 2025: + sales: + setup: + owning_organisation_id: + page_header: "" + check_answer_label: "Owning organisation" + hint_text: "" + question_text: "Which organisation owns this log?" + + managing_organisation_id: + page_header: "" + check_answer_label: "Reported by" + hint_text: "" + question_text: "Which organisation is reporting this sale?" + + assigned_to_id: + page_header: "" + check_answer_label: "Log owner" + hint_text: "" + question_text: "Which user are you creating this log for?" + + saledate: + page_header: "" + check_answer_label: "Sale completion date" + hint_text: "" + question_text: "What is the sale completion date?" + + purchid: + page_header: "" + check_answer_label: "Purchaser code" + hint_text: "This is how you usually refer to the purchaser on your own systems." + question_text: "What is the purchaser code?" + + ownershipsch: + page_header: "" + check_answer_label: "Purchase made under ownership scheme" + hint_text: "" + question_text: "Was this purchase made through an ownership scheme?" + + type: + shared_ownership: + page_header: "Type of shared ownership sale" + check_answer_label: "Type of shared ownership sale" + hint_text: "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" + question_text: "What is the type of shared ownership sale?" + discounted_ownership: + page_header: "Type of discounted ownership sale" + check_answer_label: "Type of discounted ownership sale" + hint_text: "" + question_text: "What is the type of discounted ownership sale?" + outright_ownership: + page_header: "Type of outright sale" + type: + check_answer_label: "Type of outright sale" + hint_text: "" + question_text: "What is the type of outright sale?" + othtype: + check_answer_label: "Type of other sale" + hint_text: "" + question_text: "What type of sale is it?" + + companybuy: + page_header: "" + check_answer_label: "Company buyer" + hint_text: "" + question_text: "Is the buyer a company?" + + buylivein: + page_header: "" + check_answer_label: "Buyers living in property" + hint_text: "" + question_text: "Will any buyers live in the property?" + + jointpur: + page_header: "" + check_answer_label: "Joint purchase" + hint_text: "This is where two or more people are named as legal owners of the property after the purchase" + question_text: "Is this a joint purchase?" + + jointmore: + page_header: "" + check_answer_label: "More than 2 joint buyers" + hint_text: "" + question_text: "Are there more than 2 joint buyers of this property?" + + noint: + joint_purchase: + page_header: "" + check_answer_label: "Buyers interviewed in person?" + hint_text: "You should still try to answer all questions even if the buyers weren’t interviewed in person" + question_text: "Were the buyers interviewed for any of the answers you will provide on this log?" + not_joint_purchase: + page_header: "" + check_answer_label: "Buyer interviewed in person?" + hint_text: "You should still try to answer all questions even if the buyer wasn’t interviewed in person" + question_text: "Was the buyer interviewed for any of the answers you will provide on this log?" + + privacynotice: + joint_purchase: + page_header: "Ministry of Housing, Communities and Local Government privacy notice" + check_answer_label: "Buyers have seen the privacy notice?" + hint_text: "" + question_text: "Declaration" + not_joint_purchase: + page_header: "Ministry of Housing, Communities and Local Government privacy notice" + check_answer_label: "Buyer has seen the privacy notice?" + hint_text: "" + question_text: "Declaration" diff --git a/config/locales/forms/2025/sales/soft_validations.en.yml b/config/locales/forms/2025/sales/soft_validations.en.yml new file mode 100644 index 000000000..c8f0990ba --- /dev/null +++ b/config/locales/forms/2025/sales/soft_validations.en.yml @@ -0,0 +1,244 @@ +en: + forms: + 2025: + sales: + soft_validations: + retirement_value_check: + max: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person isn't retired?" + title_text: "You told us this person is over 66 and not retired." + informative_text: "The minimum expected retirement age in England is 66." + min: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person is retired?" + title_text: "You told us this person is aged %{age} years and retired." + informative_text: "The minimum expected retirement age in England is 66." + old_persons_shared_ownership_value_check: + page_header: "" + check_answer_label: "Shared ownership confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: + joint_purchase: "You told us the buyers are using the Older Persons Shared Ownership scheme." + not_joint_purchase: "You told us the buyer is using the Older Persons Shared Ownership scheme." + informative_text: "At least one buyer must be aged 65 years and over to use this scheme." + income1_value_check: + check_answer_label: "Buyer 1 income confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + min: + page_header: "" + title_text: "You told us income was %{income}." + informative_text: "This is less than we would expect for someone in this working situation." + max: + page_header: "" + title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?" + + income2_value_check: + check_answer_label: "Buyer 2 income confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + min: + page_header: "" + title_text: "You told us income was %{income}." + informative_text: "This is less than we would expect for someone in this working situation." + max: + page_header: "" + title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?" + + combined_income_value_check: + page_header: "" + check_answer_label: "Combined income confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?" + + mortgage_value_check: + page_header: "" + check_answer_label: "Mortgage confirmation" + hint_text: "" + question_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?" + title_text: "You told us that the mortgage amount is %{mortgage}." + informative_text: "This is more than 5 times the income, which is higher than we would expect." + + savings_value_check: + page_header: "" + check_answer_label: "Savings confirmation" + hint_text: "" + question_text: "Are you sure the savings are higher than £100,000?" + joint_purchase: + title_text: "You told us the buyers’ savings were %{savings}." + informative_text: "This is higher than we would expect." + not_joint_purchase: + title_text: "You told us the buyer’s savings were %{savings}." + informative_text: "This is higher than we would expect." + + staircase_bought_value_check: + page_header: "" + check_answer_label: "Percentage bought confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that %{percentage}% was bought in this staircasing transaction." + informative_text: "Most staircasing transactions are less than 50%" + + stairowned_value_check: + joint_purchase: + page_header: "" + check_answer_label: "Percentage owned confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us that the buyers now own %{stairowned} of the property." + informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct." + not_joint_purchase: + page_header: "" + check_answer_label: "Percentage owned confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us that the buyer now owns %{stairowned} of the property." + informative_text: "The maximum percentage that can be owned under the Older Persons Shared Ownership scheme is 75%, unless the property was funded outside the Affordable Homes Programme. Make sure these answers are correct." + + hodate_check: + page_header: "" + check_answer_label: "Practical completion or handover date check" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us practical completion or handover date is more than 3 years before sale completion date." + + value_value_check: + page_header: "" + check_answer_label: "Purchase price confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us the purchase price is %{value}." + informative_text: "This is %{higher_or_lower} than we would expect." + + shared_ownership_deposit_value_check: + page_header: "" + check_answer_label: "Shared ownership deposit confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}." + + deposit_value_check: + joint_purchase: + page_header: "" + check_answer_label: "Deposit confirmation" + hint_text: "" + question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" + title_text: "You told us the buyers’ deposit was %{deposit} and their savings were %{savings}." + informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." + not_joint_purchase: + page_header: "" + check_answer_label: "Deposit confirmation" + hint_text: "" + question_text: "Are you sure that the deposit is this much higher than the buyer's savings?" + title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." + informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." + + address_search_value_check: + page_header: "" + check_answer_label: "" + hint_text: "" + question_text: "" + title_text: "No address found." + informative_text: "We could not find an address that matches your search. You can search again or continue to enter the address manually." + + wheel_value_check: + page_header: "" + check_answer_label: "Does anyone in the household use a wheelchair?" + hint_text: "" + question_text: "You told us that someone in the household uses a wheelchair." + title_text: "You told us that someone in the household uses a wheelchair." + + buyer_livein_value_check: + buyer1: + page_header: "" + check_answer_label: "Buyer live in confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that buyer 1 will not live in the property." + informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." + buyer2: + page_header: "" + check_answer_label: "Buyer live in confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that buyer 2 will not live in the property." + informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." + + student_not_child_value_check: + page_header: "" + check_answer_label: "Student not a child confirmation" + hint_text: "" + question_text: "Are you sure this person is not a child?" + title_text: "You told us this person is a student aged between 16 and 19." + informative_text: "Are you sure this person is not a child?" + + partner_under_16_value_check: + page_header: "" + check_answer_label: "Partner under 16 confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1." + informative_text: "Are you sure this is correct?" + + multiple_partners_value_check: + page_header: "" + check_answer_label: "Multiple partners confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us there are more than 1 persons with 'Partner' relationship to buyer 1." + informative_text: "Are you sure this is correct?" + + monthly_charges_value_check: + page_header: "" + check_answer_label: "Monthly charges confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the monthly charges were %{mscharge}." + informative_text: "This is higher than we would expect." + + extra_borrowing_value_check: + page_header: "" + check_answer_label: "Extra borrowing confirmation" + hint_text: "" + question_text: "Are you sure there is no extra borrowing?" + title_text: "You told us that the mortgage and deposit total is %{mortgage_and_deposit_total}." + informative_text: "This is higher than the purchase price minus the discount." + + percentage_discount_value_check: + page_header: "" + check_answer_label: "Percentage discount confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the percentage discount is %{discount}." + informative_text: "This is higher than we would expect." + + grant_value_check: + page_header: "" + check_answer_label: "Grant value confirmation" + hint_text: "" + question_text: "Are you sure? Grants are usually £9,000 - £16,000" + title_text: "You told us that the grant amount is %{grant}." + informative_text: "Loans, grants and subsidies are usually between £9,000 and £16,000." + + discounted_sale_value_check: + page_header: "" + check_answer_label: "Discounted sale value confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}." + informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}." + + deposit_and_mortgage_value_check: + page_header: "" + check_answer_label: "Deposit and mortgage against discount confirmation" + hint_text: "" + question_text: "Are you sure? Mortgage and deposit usually equal or are more than (value - discount)" + title_text: "You told us the mortgage amount was %{mortgage}, the cash deposit was %{deposit} and the discount was %{discount}." + informative_text: "We would expect the mortgage amount and the deposit added together to be the same as the purchase price minus the discount." diff --git a/spec/helpers/filters_helper_spec.rb b/spec/helpers/filters_helper_spec.rb index b709a16ac..ce60d07f7 100644 --- a/spec/helpers/filters_helper_spec.rb +++ b/spec/helpers/filters_helper_spec.rb @@ -517,12 +517,46 @@ RSpec.describe FiltersHelper do allow(Time).to receive(:now).and_return(Time.zone.local(2024, 5, 1)) end - it "has the correct options" do - expect(collection_year_options).to eq( - { - "2024" => "2024 to 2025", "2023" => "2023 to 2024", "2022" => "2022 to 2023" - }, - ) + context "and in crossover period" do + before do + allow(FormHandler.instance).to receive(:in_crossover_period?).and_return(true) + end + + it "has the correct options" do + expect(collection_year_options).to eq( + { + "2024" => "2024 to 2025", "2023" => "2023 to 2024", "2022" => "2022 to 2023" + }, + ) + end + end + + context "and not in crossover period" do + before do + allow(FormHandler.instance).to receive(:in_crossover_period?).and_return(false) + end + + it "has the correct options" do + expect(collection_year_options).to eq( + { + "2024" => "2024 to 2025", "2023" => "2023 to 2024" + }, + ) + end + + context "with future form use turned on" do + before do + allow(FeatureToggle).to receive(:allow_future_form_use?).and_return(true) + end + + it "includes next year in the options" do + expect(collection_year_options).to eq( + { + "2025" => "2025 to 2026", "2024" => "2024 to 2025", "2023" => "2023 to 2024" + }, + ) + end + end end end end From 6fb29ade6bd434cc130c5ec558ee8fa37676da30 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:54:42 +0000 Subject: [PATCH 09/27] CLDC-3712: Sales Form Updates (#2756) --- .../lettings_log_variables.rb | 4 +- .../derived_variables/sales_log_variables.rb | 4 +- app/models/form.rb | 6 +- .../lettings/pages/lead_tenant_nationality.rb | 4 +- .../pages/property_local_authority.rb | 4 +- app/models/form/lettings/pages/uprn.rb | 4 +- app/models/form/lettings/questions/age.rb | 2 +- .../form/lettings/questions/declaration.rb | 6 +- .../form/lettings/questions/ethnic_white.rb | 2 +- ...rst_time_property_let_as_social_housing.rb | 4 +- .../lettings/questions/housingneeds_other.rb | 2 +- .../form/lettings/questions/is_carehome.rb | 2 +- app/models/form/lettings/questions/layear.rb | 2 +- .../lettings/questions/letting_allocation.rb | 2 +- .../lettings/questions/person_relationship.rb | 2 +- .../lettings/questions/previous_let_type.rb | 2 +- app/models/form/lettings/questions/reason.rb | 2 +- .../form/lettings/questions/reason_renewal.rb | 2 +- .../form/lettings/questions/referral.rb | 2 +- .../form/lettings/questions/referral_prp.rb | 2 +- .../questions/referral_supported_housing.rb | 2 +- .../referral_supported_housing_prp.rb | 2 +- .../form/lettings/questions/rent_type.rb | 2 +- app/models/form/lettings/questions/rsnvac.rb | 2 +- .../form/lettings/questions/sheltered.rb | 2 +- .../questions/starter_tenancy_type.rb | 2 +- .../form/lettings/questions/tenancy_type.rb | 2 +- .../lettings/questions/uprn_confirmation.rb | 2 +- .../form/lettings/questions/waityear.rb | 2 +- .../subsections/household_characteristics.rb | 44 ++++++------- .../subsections/household_situation.rb | 2 +- .../subsections/property_information.rb | 4 +- app/models/form/lettings/subsections/setup.rb | 2 +- .../subsections/tenancy_information.rb | 2 +- .../form/sales/pages/buyer1_nationality.rb | 2 +- .../form/sales/pages/buyer2_nationality.rb | 2 +- app/models/form/sales/pages/buyer_previous.rb | 2 +- app/models/form/sales/pages/deposit.rb | 2 +- .../form/sales/pages/deposit_discount.rb | 2 +- app/models/form/sales/pages/la_nominations.rb | 2 +- .../form/sales/pages/last_accommodation.rb | 2 +- .../form/sales/pages/last_accommodation_la.rb | 2 +- .../form/sales/pages/managing_organisation.rb | 2 +- .../sales/pages/property_local_authority.rb | 4 +- app/models/form/sales/pages/uprn.rb | 4 +- .../buyer1_ethnic_background_white.rb | 2 +- .../buyer2_ethnic_background_white.rb | 2 +- .../buyer2_relationship_to_buyer1.rb | 2 +- .../form/sales/questions/buyer_previous.rb | 2 +- app/models/form/sales/questions/discount.rb | 2 +- .../form/sales/questions/mortgage_lender.rb | 2 +- .../form/sales/questions/mortgageused.rb | 2 +- .../form/sales/questions/ownership_scheme.rb | 2 +- .../person_relationship_to_buyer_1.rb | 2 +- .../form/sales/questions/privacy_notice.rb | 4 +- .../form/sales/questions/uprn_confirmation.rb | 2 +- .../subsections/household_characteristics.rb | 66 +++++++++---------- .../form/sales/subsections/outright_sale.rb | 4 +- .../sales/subsections/property_information.rb | 2 +- app/models/form/sales/subsections/setup.rb | 8 +-- .../subsections/shared_ownership_scheme.rb | 4 +- app/models/lettings_log.rb | 4 +- app/models/sales_log.rb | 6 +- .../validations/household_validations.rb | 10 +-- .../validations/property_validations.rb | 2 +- .../sales/financial_validations.rb | 4 +- .../sales/household_validations.rb | 12 ++-- .../validations/sales/property_validations.rb | 2 +- .../sales/sale_information_validations.rb | 18 ++--- .../validations/sales/soft_validations.rb | 4 +- app/models/validations/shared_validations.rb | 2 +- .../exports/lettings_log_export_service.rb | 4 +- ...ime_property_let_as_social_housing_spec.rb | 2 +- ...ead_tenant_ethnic_background_white_spec.rb | 2 +- .../form/lettings/pages/person_age_spec.rb | 2 +- .../pages/person_relationship_to_lead_spec.rb | 2 +- .../pages/previous_local_authority_spec.rb | 2 +- .../lettings/pages/previous_postcode_spec.rb | 2 +- .../pages/property_local_authority_spec.rb | 4 +- .../property_wheelchair_accessible_spec.rb | 2 +- .../form/lettings/pages/renewal_spec.rb | 2 +- .../form/lettings/pages/rent_type_spec.rb | 2 +- .../pages/starter_tenancy_type_spec.rb | 2 +- spec/models/form/lettings/pages/uprn_spec.rb | 4 +- .../lettings/questions/age1_known_spec.rb | 2 +- .../form/lettings/questions/age_spec.rb | 2 +- .../lettings/questions/declaration_spec.rb | 6 +- .../lettings/questions/ethnic_white_spec.rb | 4 +- ...ime_property_let_as_social_housing_spec.rb | 4 +- .../questions/gender_identity1_spec.rb | 2 +- .../models/form/lettings/questions/hb_spec.rb | 2 +- .../questions/housingneeds_other_spec.rb | 4 +- .../lettings/questions/is_carehome_spec.rb | 4 +- .../form/lettings/questions/joint_spec.rb | 2 +- .../form/lettings/questions/layear_spec.rb | 4 +- .../questions/letting_allocation_spec.rb | 4 +- .../questions/person_relationship_spec.rb | 2 +- .../form/lettings/questions/ppcodenk_spec.rb | 2 +- .../questions/previous_la_known_spec.rb | 2 +- .../questions/previous_let_type_spec.rb | 4 +- .../lettings/questions/reason_renewal_spec.rb | 4 +- .../form/lettings/questions/reason_spec.rb | 4 +- .../lettings/questions/reasonpref_spec.rb | 2 +- .../lettings/questions/referral_prp_spec.rb | 4 +- .../form/lettings/questions/referral_spec.rb | 4 +- .../referral_supported_housing_prp_spec.rb | 4 +- .../referral_supported_housing_spec.rb | 4 +- .../form/lettings/questions/renewal_spec.rb | 2 +- .../form/lettings/questions/rent_type_spec.rb | 6 +- .../form/lettings/questions/rsnvac_spec.rb | 4 +- .../form/lettings/questions/scheme_id_spec.rb | 2 +- .../form/lettings/questions/sheltered_spec.rb | 4 +- .../questions/starter_tenancy_type_spec.rb | 4 +- .../tenancy_length_affordable_rent_spec.rb | 2 +- .../tenancy_length_intermediate_rent_spec.rb | 2 +- .../lettings/questions/tenancy_type_spec.rb | 6 +- .../form/lettings/questions/waityear_spec.rb | 4 +- .../lettings/questions/wheelchair_spec.rb | 2 +- .../household_characteristics_spec.rb | 4 +- .../subsections/household_situation_spec.rb | 4 +- .../subsections/property_information_spec.rb | 4 +- .../form/lettings/subsections/setup_spec.rb | 4 +- .../subsections/tenancy_information_spec.rb | 4 +- .../buyer1_ethnic_background_arab_spec.rb | 2 +- .../buyer1_ethnic_background_asian_spec.rb | 2 +- .../buyer1_ethnic_background_black_spec.rb | 2 +- .../buyer1_ethnic_background_mixed_spec.rb | 2 +- .../buyer1_ethnic_background_white_spec.rb | 2 +- .../sales/pages/buyer1_ethnic_group_spec.rb | 2 +- .../pages/buyer1_live_in_property_spec.rb | 2 +- .../sales/pages/buyer1_nationality_spec.rb | 4 +- .../pages/buyer1_working_situation_spec.rb | 2 +- .../sales/pages/buyer2_nationality_spec.rb | 4 +- .../buyer2_relationship_to_buyer1_spec.rb | 2 +- .../form/sales/pages/buyer_interview_spec.rb | 4 +- .../form/sales/pages/buyer_live_spec.rb | 2 +- .../form/sales/pages/buyer_previous_spec.rb | 2 +- .../form/sales/pages/deposit_discount_spec.rb | 4 +- spec/models/form/sales/pages/deposit_spec.rb | 6 +- spec/models/form/sales/pages/discount_spec.rb | 2 +- .../form/sales/pages/la_nominations_spec.rb | 2 +- .../sales/pages/last_accommodation_la_spec.rb | 2 +- .../sales/pages/last_accommodation_spec.rb | 2 +- .../sales/pages/managing_organisation_spec.rb | 4 +- .../person_relationship_to_buyer1_spec.rb | 2 +- .../form/sales/pages/privacy_notice_spec.rb | 6 +- .../pages/property_local_authority_spec.rb | 4 +- .../property_wheelchair_accessible_spec.rb | 2 +- .../form/sales/pages/purchase_price_spec.rb | 2 +- .../sales/pages/shared_ownership_type_spec.rb | 2 +- spec/models/form/sales/pages/uprn_spec.rb | 4 +- .../buyer1_ethnic_background_arab_spec.rb | 2 +- .../buyer1_ethnic_background_asian_spec.rb | 2 +- .../buyer1_ethnic_background_black_spec.rb | 2 +- .../buyer1_ethnic_background_mixed_spec.rb | 2 +- .../buyer1_ethnic_background_white_spec.rb | 4 +- .../questions/buyer1_ethnic_group_spec.rb | 2 +- .../questions/buyer1_live_in_property_spec.rb | 2 +- .../buyer1_working_situation_spec.rb | 2 +- .../buyer2_ethnic_background_white_spec.rb | 4 +- .../buyer2_relationship_to_buyer1_spec.rb | 2 +- .../sales/questions/buyer_interview_spec.rb | 10 +-- .../form/sales/questions/buyer_live_spec.rb | 2 +- .../sales/questions/buyer_previous_spec.rb | 4 +- .../form/sales/questions/discount_spec.rb | 4 +- .../sales/questions/mortgage_lender_spec.rb | 6 +- .../form/sales/questions/mortgageused_spec.rb | 4 +- .../questions/nationality_all_group_spec.rb | 2 +- .../questions/number_joint_buyers_spec.rb | 2 +- .../sales/questions/ownership_scheme_spec.rb | 4 +- .../form/sales/questions/person_age_spec.rb | 2 +- .../person_relationship_to_buyer1_spec.rb | 2 +- .../sales/questions/privacy_notice_spec.rb | 6 +- .../property_wheelchair_accessible_spec.rb | 2 +- .../questions/shared_ownership_type_spec.rb | 6 +- .../household_characteristics_spec.rb | 6 +- .../sales/subsections/outright_sale_spec.rb | 6 +- .../subsections/property_information_spec.rb | 4 +- .../form/sales/subsections/setup_spec.rb | 4 +- .../shared_ownership_scheme_spec.rb | 2 +- .../validations/property_validations_spec.rb | 4 +- 181 files changed, 342 insertions(+), 338 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index e50161188..9219392f7 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -65,7 +65,7 @@ module DerivedVariables::LettingsLogVariables self.has_benefits = get_has_benefits self.tshortfall_known = 0 if tshortfall self.nocharge = household_charge&.zero? ? 1 : 0 - if form.start_year_after_2024? && is_bedsit? + if form.start_year_2024_or_later? && is_bedsit? self.beds = 1 end @@ -186,7 +186,7 @@ private self.wchair = nil self.location_id = nil end - if form.start_year_after_2024? && (unittype_gn_changed? && unittype_gn_was == 2) + if form.start_year_2024_or_later? && (unittype_gn_changed? && unittype_gn_was == 2) self.beds = nil end end diff --git a/app/models/derived_variables/sales_log_variables.rb b/app/models/derived_variables/sales_log_variables.rb index f23f9eb28..e182c2158 100644 --- a/app/models/derived_variables/sales_log_variables.rb +++ b/app/models/derived_variables/sales_log_variables.rb @@ -29,7 +29,7 @@ module DerivedVariables::SalesLogVariables end end - if saledate && form.start_year_after_2024? && discounted_ownership_sale? + if saledate && form.start_year_2024_or_later? && discounted_ownership_sale? self.ppostcode_full = postcode_full self.ppcodenk = pcodenk self.prevloc = la @@ -44,7 +44,7 @@ module DerivedVariables::SalesLogVariables self.hhmemb = number_of_household_members self.hhtype = household_type - if saledate && form.start_year_after_2024? + if saledate && form.start_year_2024_or_later? self.soctenant = soctenant_from_prevten_values child_under_16_constraints! end diff --git a/app/models/form.rb b/app/models/form.rb index 4336376e6..ce77378ca 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -334,7 +334,11 @@ class Form type == "sales" || (start_year && start_year.to_i > 2022) end - def start_year_after_2024? + def start_year_2024_or_later? start_date && start_date.year >= 2024 end + + def start_year_2025_or_later? + start_date && start_date.year >= 2025 + end end diff --git a/app/models/form/lettings/pages/lead_tenant_nationality.rb b/app/models/form/lettings/pages/lead_tenant_nationality.rb index d4845f8f9..410a6320f 100644 --- a/app/models/form/lettings/pages/lead_tenant_nationality.rb +++ b/app/models/form/lettings/pages/lead_tenant_nationality.rb @@ -2,12 +2,12 @@ class Form::Lettings::Pages::LeadTenantNationality < ::Form::Page def initialize(id, hsh, subsection) super @id = "lead_tenant_nationality" - @copy_key = "lettings.household_characteristics.#{form.start_year_after_2024? ? 'nationality_all' : 'national'}" + @copy_key = "lettings.household_characteristics.#{form.start_year_2024_or_later? ? 'nationality_all' : 'national'}" @depends_on = [{ "declaration" => 1 }] end def questions - @questions ||= if form.start_year_after_2024? + @questions ||= if form.start_year_2024_or_later? [ Form::Lettings::Questions::NationalityAllGroup.new(nil, nil, self), Form::Lettings::Questions::NationalityAll.new(nil, nil, self), diff --git a/app/models/form/lettings/pages/property_local_authority.rb b/app/models/form/lettings/pages/property_local_authority.rb index 1e3d34bd2..339ccb4d8 100644 --- a/app/models/form/lettings/pages/property_local_authority.rb +++ b/app/models/form/lettings/pages/property_local_authority.rb @@ -3,8 +3,8 @@ class Form::Lettings::Pages::PropertyLocalAuthority < ::Form::Page super @id = "property_local_authority" @depends_on = [ - { "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_after_2024?" => false }, - { "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_after_2024?" => true, "address_search_given?" => true }, + { "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_2024_or_later?" => false }, + { "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_2024_or_later?" => true, "address_search_given?" => true }, ] end diff --git a/app/models/form/lettings/pages/uprn.rb b/app/models/form/lettings/pages/uprn.rb index 474928eb3..b9a3a4e94 100644 --- a/app/models/form/lettings/pages/uprn.rb +++ b/app/models/form/lettings/pages/uprn.rb @@ -14,7 +14,7 @@ class Form::Lettings::Pages::Uprn < ::Form::Page end def skip_text - if form.start_year_after_2024? + if form.start_year_2024_or_later? "Search for address instead" else "Enter address instead" @@ -24,7 +24,7 @@ class Form::Lettings::Pages::Uprn < ::Form::Page def skip_href(log = nil) return unless log - if form.start_year_after_2024? + if form.start_year_2024_or_later? "address-matcher" else "address" diff --git a/app/models/form/lettings/questions/age.rb b/app/models/form/lettings/questions/age.rb index b861cb39f..f35abe61e 100644 --- a/app/models/form/lettings/questions/age.rb +++ b/app/models/form/lettings/questions/age.rb @@ -27,7 +27,7 @@ class Form::Lettings::Questions::Age < ::Form::Question end def hint_text - if form.start_year_after_2024? + if form.start_year_2024_or_later? "Answer 1 for children aged under 1 year old" end end diff --git a/app/models/form/lettings/questions/declaration.rb b/app/models/form/lettings/questions/declaration.rb index 0e2fd5b2c..3261452cd 100644 --- a/app/models/form/lettings/questions/declaration.rb +++ b/app/models/form/lettings/questions/declaration.rb @@ -3,13 +3,13 @@ class Form::Lettings::Questions::Declaration < ::Form::Question super @id = "declaration" @type = "checkbox" - @check_answers_card_number = 0 unless form.start_year_after_2024? + @check_answers_card_number = 0 unless form.start_year_2024_or_later? @top_guidance_partial = "privacy_notice_tenant" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end def answer_options - declaration_text = if form.start_year_after_2024? + declaration_text = if form.start_year_2024_or_later? "The tenant has seen or been given access to the MHCLG privacy notice" else "The tenant has seen the MHCLG privacy notice" @@ -19,7 +19,7 @@ class Form::Lettings::Questions::Declaration < ::Form::Question end def unanswered_error_message - if form.start_year_after_2024? + if form.start_year_2024_or_later? I18n.t("validations.declaration.missing.post_2024") else I18n.t("validations.declaration.missing.pre_2024") diff --git a/app/models/form/lettings/questions/ethnic_white.rb b/app/models/form/lettings/questions/ethnic_white.rb index 40b99bc9f..74430d840 100644 --- a/app/models/form/lettings/questions/ethnic_white.rb +++ b/app/models/form/lettings/questions/ethnic_white.rb @@ -9,7 +9,7 @@ class Form::Lettings::Questions::EthnicWhite < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" }, "2" => { "value" => "Irish" }, diff --git a/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb b/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb index 9d54cfcb3..bc1c66cb4 100644 --- a/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb +++ b/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb @@ -15,11 +15,11 @@ class Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing < ::Form::Q end def yes_hint - form.start_year_after_2024? ? "This property was previously used for other purposes or is a new-build." : "This is a new let." + form.start_year_2024_or_later? ? "This property was previously used for other purposes or is a new-build." : "This is a new let." end def no_hint - form.start_year_after_2024? ? "This is a re-let of existing social housing stock." : "This is a re-let of existing social housing." + form.start_year_2024_or_later? ? "This is a re-let of existing social housing stock." : "This is a re-let of existing social housing." end QUESTION_NUMBER_FROM_YEAR = { 2023 => 14, 2024 => 15 }.freeze diff --git a/app/models/form/lettings/questions/housingneeds_other.rb b/app/models/form/lettings/questions/housingneeds_other.rb index 75834d3bb..fc403d00c 100644 --- a/app/models/form/lettings/questions/housingneeds_other.rb +++ b/app/models/form/lettings/questions/housingneeds_other.rb @@ -9,7 +9,7 @@ class Form::Lettings::Questions::HousingneedsOther < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Yes" }, "0" => { "value" => "No" }, diff --git a/app/models/form/lettings/questions/is_carehome.rb b/app/models/form/lettings/questions/is_carehome.rb index efb29a817..25dae3fc6 100644 --- a/app/models/form/lettings/questions/is_carehome.rb +++ b/app/models/form/lettings/questions/is_carehome.rb @@ -10,7 +10,7 @@ class Form::Lettings::Questions::IsCarehome < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Yes" }, "0" => { "value" => "No" }, diff --git a/app/models/form/lettings/questions/layear.rb b/app/models/form/lettings/questions/layear.rb index 63f99c36f..fdaad6c22 100644 --- a/app/models/form/lettings/questions/layear.rb +++ b/app/models/form/lettings/questions/layear.rb @@ -8,7 +8,7 @@ class Form::Lettings::Questions::Layear < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Just moved to local authority area with this new let" }, "2" => { "value" => "Less than 1 year" }, diff --git a/app/models/form/lettings/questions/letting_allocation.rb b/app/models/form/lettings/questions/letting_allocation.rb index 0ae7b740d..08310da13 100644 --- a/app/models/form/lettings/questions/letting_allocation.rb +++ b/app/models/form/lettings/questions/letting_allocation.rb @@ -8,7 +8,7 @@ class Form::Lettings::Questions::LettingAllocation < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "cbl" => { "value" => "Choice-based lettings (CBL)", "hint" => "Where available vacant properties are advertised and applicants are able to bid for specific properties." }, "cap" => { "value" => "Common Allocation Policy (CAP)", "hint" => "Where a common system agreed between a group of housing providers is used to determine applicant’s priority for housing." }, diff --git a/app/models/form/lettings/questions/person_relationship.rb b/app/models/form/lettings/questions/person_relationship.rb index ec7a78969..d39cb49ff 100644 --- a/app/models/form/lettings/questions/person_relationship.rb +++ b/app/models/form/lettings/questions/person_relationship.rb @@ -10,7 +10,7 @@ class Form::Lettings::Questions::PersonRelationship < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "P" => { "value" => "Partner" }, "C" => { "value" => "Child" }, diff --git a/app/models/form/lettings/questions/previous_let_type.rb b/app/models/form/lettings/questions/previous_let_type.rb index 577571571..8c50cb41a 100644 --- a/app/models/form/lettings/questions/previous_let_type.rb +++ b/app/models/form/lettings/questions/previous_let_type.rb @@ -4,7 +4,7 @@ class Form::Lettings::Questions::PreviousLetType < ::Form::Question @id = "unitletas" @type = "radio" @check_answers_card_number = 0 - @answer_options = form.start_year_after_2024? ? ANSWER_OPTIONS_AFTER_2024 : ANSWER_OPTIONS + @answer_options = form.start_year_2024_or_later? ? ANSWER_OPTIONS_AFTER_2024 : ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/app/models/form/lettings/questions/reason.rb b/app/models/form/lettings/questions/reason.rb index 4bc00ce43..3a659fc5c 100644 --- a/app/models/form/lettings/questions/reason.rb +++ b/app/models/form/lettings/questions/reason.rb @@ -14,7 +14,7 @@ class Form::Lettings::Questions::Reason < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "50" => { "value" => "End of social or private sector tenancy - no fault" }, "51" => { "value" => "End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)" }, diff --git a/app/models/form/lettings/questions/reason_renewal.rb b/app/models/form/lettings/questions/reason_renewal.rb index 9a9ee72de..c00bd2581 100644 --- a/app/models/form/lettings/questions/reason_renewal.rb +++ b/app/models/form/lettings/questions/reason_renewal.rb @@ -14,7 +14,7 @@ class Form::Lettings::Questions::ReasonRenewal < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "50" => { "value" => "End of social or private sector tenancy - no fault" }, "51" => { "value" => "End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)" }, diff --git a/app/models/form/lettings/questions/referral.rb b/app/models/form/lettings/questions/referral.rb index 904668a4b..98e5a9186 100644 --- a/app/models/form/lettings/questions/referral.rb +++ b/app/models/form/lettings/questions/referral.rb @@ -9,7 +9,7 @@ class Form::Lettings::Questions::Referral < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Internal transfer", diff --git a/app/models/form/lettings/questions/referral_prp.rb b/app/models/form/lettings/questions/referral_prp.rb index 76ad3fbf8..96da2cba3 100644 --- a/app/models/form/lettings/questions/referral_prp.rb +++ b/app/models/form/lettings/questions/referral_prp.rb @@ -9,7 +9,7 @@ class Form::Lettings::Questions::ReferralPrp < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Internal transfer", diff --git a/app/models/form/lettings/questions/referral_supported_housing.rb b/app/models/form/lettings/questions/referral_supported_housing.rb index 50822705e..d8d05fade 100644 --- a/app/models/form/lettings/questions/referral_supported_housing.rb +++ b/app/models/form/lettings/questions/referral_supported_housing.rb @@ -9,7 +9,7 @@ class Form::Lettings::Questions::ReferralSupportedHousing < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Internal transfer", diff --git a/app/models/form/lettings/questions/referral_supported_housing_prp.rb b/app/models/form/lettings/questions/referral_supported_housing_prp.rb index cab8fbbc9..75cc218fe 100644 --- a/app/models/form/lettings/questions/referral_supported_housing_prp.rb +++ b/app/models/form/lettings/questions/referral_supported_housing_prp.rb @@ -9,7 +9,7 @@ class Form::Lettings::Questions::ReferralSupportedHousingPrp < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Internal transfer", diff --git a/app/models/form/lettings/questions/rent_type.rb b/app/models/form/lettings/questions/rent_type.rb index bc6934200..b941dfcc3 100644 --- a/app/models/form/lettings/questions/rent_type.rb +++ b/app/models/form/lettings/questions/rent_type.rb @@ -5,7 +5,7 @@ class Form::Lettings::Questions::RentType < ::Form::Question @copy_key = "lettings.setup.rent_type.rent_type" @type = "radio" @top_guidance_partial = "rent_type_definitions" - @answer_options = form.start_year_after_2024? ? ANSWER_OPTIONS_2024 : ANSWER_OPTIONS + @answer_options = form.start_year_2024_or_later? ? ANSWER_OPTIONS_2024 : ANSWER_OPTIONS @conditional_for = { "irproduct_other" => [5] } @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present? end diff --git a/app/models/form/lettings/questions/rsnvac.rb b/app/models/form/lettings/questions/rsnvac.rb index 935980712..3f767d311 100644 --- a/app/models/form/lettings/questions/rsnvac.rb +++ b/app/models/form/lettings/questions/rsnvac.rb @@ -8,7 +8,7 @@ class Form::Lettings::Questions::Rsnvac < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "14" => { "value" => "Renewal of fixed-term tenancy", diff --git a/app/models/form/lettings/questions/sheltered.rb b/app/models/form/lettings/questions/sheltered.rb index 7b80bb5bf..458772675 100644 --- a/app/models/form/lettings/questions/sheltered.rb +++ b/app/models/form/lettings/questions/sheltered.rb @@ -8,7 +8,7 @@ class Form::Lettings::Questions::Sheltered < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Yes – specialist retirement housing" }, "2" => { "value" => "Yes – extra care housing" }, "5" => { "value" => "Yes – sheltered housing for adults aged under 55 years" }, diff --git a/app/models/form/lettings/questions/starter_tenancy_type.rb b/app/models/form/lettings/questions/starter_tenancy_type.rb index 85d4a14ff..03d3fee88 100644 --- a/app/models/form/lettings/questions/starter_tenancy_type.rb +++ b/app/models/form/lettings/questions/starter_tenancy_type.rb @@ -10,7 +10,7 @@ class Form::Lettings::Questions::StarterTenancyType < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "4" => { "value" => "Assured Shorthold Tenancy (AST) – Fixed term", diff --git a/app/models/form/lettings/questions/tenancy_type.rb b/app/models/form/lettings/questions/tenancy_type.rb index 9a83b44cb..c67895bef 100644 --- a/app/models/form/lettings/questions/tenancy_type.rb +++ b/app/models/form/lettings/questions/tenancy_type.rb @@ -10,7 +10,7 @@ class Form::Lettings::Questions::TenancyType < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "4" => { "value" => "Assured Shorthold Tenancy (AST) – Fixed term", diff --git a/app/models/form/lettings/questions/uprn_confirmation.rb b/app/models/form/lettings/questions/uprn_confirmation.rb index 1c31485b6..2f03cb357 100644 --- a/app/models/form/lettings/questions/uprn_confirmation.rb +++ b/app/models/form/lettings/questions/uprn_confirmation.rb @@ -8,7 +8,7 @@ class Form::Lettings::Questions::UprnConfirmation < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Yes" }, "0" => { "value" => "No, I want to search for the address instead" }, diff --git a/app/models/form/lettings/questions/waityear.rb b/app/models/form/lettings/questions/waityear.rb index 045765951..67a560167 100644 --- a/app/models/form/lettings/questions/waityear.rb +++ b/app/models/form/lettings/questions/waityear.rb @@ -8,7 +8,7 @@ class Form::Lettings::Questions::Waityear < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "2" => { "value" => "Less than 1 year" }, "7" => { "value" => "1 year but under 2 years" }, diff --git a/app/models/form/lettings/subsections/household_characteristics.rb b/app/models/form/lettings/subsections/household_characteristics.rb index e95cdf19c..61334d84c 100644 --- a/app/models/form/lettings/subsections/household_characteristics.rb +++ b/app/models/form/lettings/subsections/household_characteristics.rb @@ -8,7 +8,7 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection def pages @pages ||= [ - (Form::Lettings::Pages::Declaration.new(nil, nil, self) unless form.start_year_after_2024?), + (Form::Lettings::Pages::Declaration.new(nil, nil, self) unless form.start_year_2024_or_later?), Form::Lettings::Pages::HouseholdMembers.new(nil, nil, self), Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadHhmembValueCheck.new(nil, nil, self), Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadHhmembValueCheck.new(nil, nil, self), @@ -33,8 +33,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::LeadTenantOverRetirementValueCheck.new("working_situation_lead_tenant_over_retirement_value_check", nil, self), Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 2), Form::Lettings::Pages::PersonRelationshipToLead.new(nil, nil, self, person_index: 2), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_2_multiple_partners_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), + (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::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::PersonAge.new(nil, nil, self, person_index: 2), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 2), @@ -42,7 +42,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_after_2024?), + (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::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, @@ -53,8 +53,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonOverRetirementValueCheck.new("working_situation_2_over_retirement_value_check", nil, self, person_index: 2), Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 3), Form::Lettings::Pages::PersonRelationshipToLead.new(nil, nil, self, person_index: 3), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_after_2024?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_3_multiple_partners_value_check", nil, self, person_index: 3) if form.start_year_after_2024?), + (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::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::PersonAge.new(nil, nil, self, person_index: 3), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 3), @@ -62,7 +62,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_after_2024?), + (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::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, @@ -73,8 +73,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonOverRetirementValueCheck.new("working_situation_3_over_retirement_value_check", nil, self, person_index: 3), Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 4), Form::Lettings::Pages::PersonRelationshipToLead.new(nil, nil, self, person_index: 4), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_after_2024?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_4_multiple_partners_value_check", nil, self, person_index: 4) if form.start_year_after_2024?), + (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::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::PersonAge.new(nil, nil, self, person_index: 4), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 4), @@ -82,7 +82,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_after_2024?), + (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::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, @@ -93,8 +93,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonOverRetirementValueCheck.new("working_situation_4_over_retirement_value_check", nil, self, person_index: 4), Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 5), Form::Lettings::Pages::PersonRelationshipToLead.new(nil, nil, self, person_index: 5), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_after_2024?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_5_multiple_partners_value_check", nil, self, person_index: 5) if form.start_year_after_2024?), + (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::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::PersonAge.new(nil, nil, self, person_index: 5), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 5), @@ -102,7 +102,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_after_2024?), + (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::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, @@ -113,8 +113,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonOverRetirementValueCheck.new("working_situation_5_over_retirement_value_check", nil, self, person_index: 5), Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 6), Form::Lettings::Pages::PersonRelationshipToLead.new(nil, nil, self, person_index: 6), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_after_2024?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_6_multiple_partners_value_check", nil, self, person_index: 6) if form.start_year_after_2024?), + (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::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::PersonAge.new(nil, nil, self, person_index: 6), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 6), @@ -122,7 +122,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_after_2024?), + (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::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, @@ -133,8 +133,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonOverRetirementValueCheck.new("working_situation_6_over_retirement_value_check", nil, self, person_index: 6), Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 7), Form::Lettings::Pages::PersonRelationshipToLead.new(nil, nil, self, person_index: 7), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_7_partner_under_16_value_check", nil, self, person_index: 7) if form.start_year_after_2024?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_7_multiple_partners_value_check", nil, self, person_index: 7) if form.start_year_after_2024?), + (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::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::PersonAge.new(nil, nil, self, person_index: 7), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 7), @@ -142,7 +142,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_after_2024?), + (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::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, @@ -153,8 +153,8 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Lettings::Pages::PersonOverRetirementValueCheck.new("working_situation_7_over_retirement_value_check", nil, self, person_index: 7), Form::Lettings::Pages::PersonKnown.new(nil, nil, self, person_index: 8), Form::Lettings::Pages::PersonRelationshipToLead.new(nil, nil, self, person_index: 8), - (Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_8_partner_under_16_value_check", nil, self, person_index: 8) if form.start_year_after_2024?), - (Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_8_multiple_partners_value_check", nil, self, person_index: 8) if form.start_year_after_2024?), + (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::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::PersonAge.new(nil, nil, self, person_index: 8), Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index: 8), @@ -162,7 +162,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_after_2024?), + (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::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/form/lettings/subsections/household_situation.rb b/app/models/form/lettings/subsections/household_situation.rb index 6646d7230..dc3fd608b 100644 --- a/app/models/form/lettings/subsections/household_situation.rb +++ b/app/models/form/lettings/subsections/household_situation.rb @@ -12,7 +12,7 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection Form::Lettings::Pages::TimeOnWaitingList.new(nil, nil, self), Form::Lettings::Pages::ReasonForLeavingLastSettledHome.new(nil, nil, self), Form::Lettings::Pages::ReasonForLeavingLastSettledHomeRenewal.new(nil, nil, self), - (Form::Lettings::Pages::ReasonotherValueCheck.new(nil, nil, self) if form.start_year_after_2024?), + (Form::Lettings::Pages::ReasonotherValueCheck.new(nil, nil, self) if form.start_year_2024_or_later?), Form::Lettings::Pages::PreviousHousingSituation.new(nil, nil, self), Form::Lettings::Pages::PreviousHousingSituationRenewal.new(nil, nil, self), Form::Lettings::Pages::Homelessness.new("homelessness", nil, self), diff --git a/app/models/form/lettings/subsections/property_information.rb b/app/models/form/lettings/subsections/property_information.rb index fa2ff0efa..c80e49e84 100644 --- a/app/models/form/lettings/subsections/property_information.rb +++ b/app/models/form/lettings/subsections/property_information.rb @@ -29,7 +29,7 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection end def uprn_questions - if form.start_year_after_2024? + if form.start_year_2024_or_later? [ Form::Lettings::Pages::Uprn.new(nil, nil, self), Form::Lettings::Pages::UprnConfirmation.new(nil, nil, self), @@ -48,7 +48,7 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection end def number_of_times_relet - Form::Lettings::Pages::PropertyNumberOfTimesRelet.new(nil, nil, self) unless form.start_year_after_2024? + Form::Lettings::Pages::PropertyNumberOfTimesRelet.new(nil, nil, self) unless form.start_year_2024_or_later? end def displayed_in_tasklist?(log) diff --git a/app/models/form/lettings/subsections/setup.rb b/app/models/form/lettings/subsections/setup.rb index 1970149ed..0e65c2f13 100644 --- a/app/models/form/lettings/subsections/setup.rb +++ b/app/models/form/lettings/subsections/setup.rb @@ -20,7 +20,7 @@ class Form::Lettings::Subsections::Setup < ::Form::Subsection Form::Lettings::Pages::RentType.new(nil, nil, self), Form::Lettings::Pages::TenantCode.new(nil, nil, self), Form::Lettings::Pages::PropertyReference.new(nil, nil, self), - (Form::Lettings::Pages::Declaration.new(nil, nil, self) if form.start_year_after_2024?), + (Form::Lettings::Pages::Declaration.new(nil, nil, self) if form.start_year_2024_or_later?), ].compact end diff --git a/app/models/form/lettings/subsections/tenancy_information.rb b/app/models/form/lettings/subsections/tenancy_information.rb index 5525c182f..f0b7f4bef 100644 --- a/app/models/form/lettings/subsections/tenancy_information.rb +++ b/app/models/form/lettings/subsections/tenancy_information.rb @@ -15,7 +15,7 @@ class Form::Lettings::Subsections::TenancyInformation < ::Form::Subsection Form::Lettings::Pages::TenancyLength.new(nil, nil, self), Form::Lettings::Pages::TenancyLengthAffordableRent.new(nil, nil, self), Form::Lettings::Pages::TenancyLengthIntermediateRent.new(nil, nil, self), - (Form::Lettings::Pages::TenancyLengthPeriodic.new(nil, nil, self) if form.start_year_after_2024?), + (Form::Lettings::Pages::TenancyLengthPeriodic.new(nil, nil, self) if form.start_year_2024_or_later?), Form::Lettings::Pages::ShelteredAccommodation.new(nil, nil, self), ].flatten.compact end diff --git a/app/models/form/sales/pages/buyer1_nationality.rb b/app/models/form/sales/pages/buyer1_nationality.rb index 6bcf12952..791ecafac 100644 --- a/app/models/form/sales/pages/buyer1_nationality.rb +++ b/app/models/form/sales/pages/buyer1_nationality.rb @@ -13,7 +13,7 @@ class Form::Sales::Pages::Buyer1Nationality < ::Form::Page end def questions - @questions ||= if form.start_year_after_2024? + @questions ||= if form.start_year_2024_or_later? [ Form::Sales::Questions::NationalityAllGroup.new("nationality_all_group", nil, self, 1), Form::Sales::Questions::NationalityAll.new("nationality_all", nil, self, 1), diff --git a/app/models/form/sales/pages/buyer2_nationality.rb b/app/models/form/sales/pages/buyer2_nationality.rb index bbec2a105..30790fd63 100644 --- a/app/models/form/sales/pages/buyer2_nationality.rb +++ b/app/models/form/sales/pages/buyer2_nationality.rb @@ -15,7 +15,7 @@ class Form::Sales::Pages::Buyer2Nationality < ::Form::Page end def questions - @questions ||= if form.start_year_after_2024? + @questions ||= if form.start_year_2024_or_later? [ Form::Sales::Questions::NationalityAllGroup.new("nationality_all_buyer2_group", nil, self, 2), Form::Sales::Questions::NationalityAll.new("nationality_all_buyer2", nil, self, 2), diff --git a/app/models/form/sales/pages/buyer_previous.rb b/app/models/form/sales/pages/buyer_previous.rb index 0d20207a3..197a68971 100644 --- a/app/models/form/sales/pages/buyer_previous.rb +++ b/app/models/form/sales/pages/buyer_previous.rb @@ -13,7 +13,7 @@ class Form::Sales::Pages::BuyerPrevious < ::Form::Page end def routed_to?(log, _current_user) - return false if log.is_staircase? && form.start_year_after_2024? + return false if log.is_staircase? && form.start_year_2024_or_later? super end diff --git a/app/models/form/sales/pages/deposit.rb b/app/models/form/sales/pages/deposit.rb index f0bbda05c..4870a3c35 100644 --- a/app/models/form/sales/pages/deposit.rb +++ b/app/models/form/sales/pages/deposit.rb @@ -15,7 +15,7 @@ class Form::Sales::Pages::Deposit < ::Form::Page def routed_to?(log, _user) return false unless super return true if log.ownershipsch == 2 || (log.ownershipsch == 3 && log.mortgageused == 1) - return false if log.stairowned_100? != @optional && form.start_year_after_2024? + return false if log.stairowned_100? != @optional && form.start_year_2024_or_later? log.ownershipsch == 1 end diff --git a/app/models/form/sales/pages/deposit_discount.rb b/app/models/form/sales/pages/deposit_discount.rb index caf726460..84fcbb45f 100644 --- a/app/models/form/sales/pages/deposit_discount.rb +++ b/app/models/form/sales/pages/deposit_discount.rb @@ -12,7 +12,7 @@ class Form::Sales::Pages::DepositDiscount < ::Form::Page end def depends_on - if form.start_year_after_2024? + if form.start_year_2024_or_later? [{ "social_homebuy?" => true, "stairowned_100?" => @optional }] else [{ "social_homebuy?" => true }] diff --git a/app/models/form/sales/pages/la_nominations.rb b/app/models/form/sales/pages/la_nominations.rb index 6adda533d..e86e0374a 100644 --- a/app/models/form/sales/pages/la_nominations.rb +++ b/app/models/form/sales/pages/la_nominations.rb @@ -12,7 +12,7 @@ class Form::Sales::Pages::LaNominations < ::Form::Page end def routed_to?(log, _current_user) - return false if log.staircase == 1 && form.start_year_after_2024? + return false if log.staircase == 1 && form.start_year_2024_or_later? super end diff --git a/app/models/form/sales/pages/last_accommodation.rb b/app/models/form/sales/pages/last_accommodation.rb index f9d167028..42620038b 100644 --- a/app/models/form/sales/pages/last_accommodation.rb +++ b/app/models/form/sales/pages/last_accommodation.rb @@ -13,7 +13,7 @@ class Form::Sales::Pages::LastAccommodation < ::Form::Page end def routed_to?(log, _user) - return false if form.start_year_after_2024? && log.discounted_ownership_sale? + return false if form.start_year_2024_or_later? && log.discounted_ownership_sale? super end diff --git a/app/models/form/sales/pages/last_accommodation_la.rb b/app/models/form/sales/pages/last_accommodation_la.rb index 9cae326bf..ceb5b272c 100644 --- a/app/models/form/sales/pages/last_accommodation_la.rb +++ b/app/models/form/sales/pages/last_accommodation_la.rb @@ -16,7 +16,7 @@ class Form::Sales::Pages::LastAccommodationLa < ::Form::Page end def routed_to?(log, _user) - return false if form.start_year_after_2024? && log.discounted_ownership_sale? + return false if form.start_year_2024_or_later? && log.discounted_ownership_sale? super end diff --git a/app/models/form/sales/pages/managing_organisation.rb b/app/models/form/sales/pages/managing_organisation.rb index 3d8e59383..bf51602a4 100644 --- a/app/models/form/sales/pages/managing_organisation.rb +++ b/app/models/form/sales/pages/managing_organisation.rb @@ -13,7 +13,7 @@ class Form::Sales::Pages::ManagingOrganisation < ::Form::Page def routed_to?(log, current_user) return false unless current_user - if form.start_year_after_2024? + if form.start_year_2024_or_later? organisation = current_user.support? ? log.owning_organisation : current_user.organisation return false unless organisation diff --git a/app/models/form/sales/pages/property_local_authority.rb b/app/models/form/sales/pages/property_local_authority.rb index 649a445f9..fe9ad1bc0 100644 --- a/app/models/form/sales/pages/property_local_authority.rb +++ b/app/models/form/sales/pages/property_local_authority.rb @@ -3,8 +3,8 @@ class Form::Sales::Pages::PropertyLocalAuthority < ::Form::Page super @id = "property_local_authority" @depends_on = [ - { "is_la_inferred" => false, "form.start_year_after_2024?" => false }, - { "is_la_inferred" => false, "form.start_year_after_2024?" => true, "address_search_given?" => true }, + { "is_la_inferred" => false, "form.start_year_2024_or_later?" => false }, + { "is_la_inferred" => false, "form.start_year_2024_or_later?" => true, "address_search_given?" => true }, ] end diff --git a/app/models/form/sales/pages/uprn.rb b/app/models/form/sales/pages/uprn.rb index fce51e543..a78b87c2f 100644 --- a/app/models/form/sales/pages/uprn.rb +++ b/app/models/form/sales/pages/uprn.rb @@ -13,7 +13,7 @@ class Form::Sales::Pages::Uprn < ::Form::Page end def skip_text - if form.start_year_after_2024? + if form.start_year_2024_or_later? "Search for address instead" else "Enter address instead" @@ -23,7 +23,7 @@ class Form::Sales::Pages::Uprn < ::Form::Page def skip_href(log = nil) return unless log - if form.start_year_after_2024? + if form.start_year_2024_or_later? "address-matcher" else "address" diff --git a/app/models/form/sales/questions/buyer1_ethnic_background_white.rb b/app/models/form/sales/questions/buyer1_ethnic_background_white.rb index 2bbe4939f..619c958f9 100644 --- a/app/models/form/sales/questions/buyer1_ethnic_background_white.rb +++ b/app/models/form/sales/questions/buyer1_ethnic_background_white.rb @@ -9,7 +9,7 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundWhite < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" }, "2" => { "value" => "Irish" }, diff --git a/app/models/form/sales/questions/buyer2_ethnic_background_white.rb b/app/models/form/sales/questions/buyer2_ethnic_background_white.rb index 232e0f99e..be3e3ccff 100644 --- a/app/models/form/sales/questions/buyer2_ethnic_background_white.rb +++ b/app/models/form/sales/questions/buyer2_ethnic_background_white.rb @@ -9,7 +9,7 @@ class Form::Sales::Questions::Buyer2EthnicBackgroundWhite < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" }, "2" => { "value" => "Irish" }, diff --git a/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb b/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb index 3f0fc299c..9520ace67 100644 --- a/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb +++ b/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb @@ -16,7 +16,7 @@ class Form::Sales::Questions::Buyer2RelationshipToBuyer1 < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "P" => { "value" => "Partner" }, diff --git a/app/models/form/sales/questions/buyer_previous.rb b/app/models/form/sales/questions/buyer_previous.rb index dfc0c2fd2..4daf963bf 100644 --- a/app/models/form/sales/questions/buyer_previous.rb +++ b/app/models/form/sales/questions/buyer_previous.rb @@ -22,7 +22,7 @@ class Form::Sales::Questions::BuyerPrevious < ::Form::Question end def derived?(_log) - form.start_year_after_2024? + form.start_year_2024_or_later? end QUESTION_NUMBER_FROM_YEAR = { 2023 => 84 }.freeze diff --git a/app/models/form/sales/questions/discount.rb b/app/models/form/sales/questions/discount.rb index 1d8c5a46b..3807a8cfc 100644 --- a/app/models/form/sales/questions/discount.rb +++ b/app/models/form/sales/questions/discount.rb @@ -5,7 +5,7 @@ class Form::Sales::Questions::Discount < ::Form::Question @type = "numeric" @copy_key = "sales.sale_information.discount" @min = 0 - @max = form.start_year_after_2024? ? 70 : 100 + @max = form.start_year_2024_or_later? ? 70 : 100 @step = 0.1 @width = 5 @suffix = "%" diff --git a/app/models/form/sales/questions/mortgage_lender.rb b/app/models/form/sales/questions/mortgage_lender.rb index c5a10efb4..a4aa55f17 100644 --- a/app/models/form/sales/questions/mortgage_lender.rb +++ b/app/models/form/sales/questions/mortgage_lender.rb @@ -60,7 +60,7 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question OPTIONS_NOT_DISPLAYED = %w[0].freeze def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? ANSWER_OPTIONS else ANSWER_OPTIONS.dup.reject { |k, _v| OPTIONS_INTRODUCED_2024.include?(k) } diff --git a/app/models/form/sales/questions/mortgageused.rb b/app/models/form/sales/questions/mortgageused.rb index 341d3ff60..e4a101072 100644 --- a/app/models/form/sales/questions/mortgageused.rb +++ b/app/models/form/sales/questions/mortgageused.rb @@ -11,7 +11,7 @@ class Form::Sales::Questions::Mortgageused < ::Form::Question end def displayed_answer_options(log, _user = nil) - if log.outright_sale? && log.saledate && !form.start_year_after_2024? + if log.outright_sale? && log.saledate && !form.start_year_2024_or_later? answer_options_without_dont_know elsif log.stairowned == 100 || log.outright_sale? ANSWER_OPTIONS diff --git a/app/models/form/sales/questions/ownership_scheme.rb b/app/models/form/sales/questions/ownership_scheme.rb index 6b33a2566..f42f03f37 100644 --- a/app/models/form/sales/questions/ownership_scheme.rb +++ b/app/models/form/sales/questions/ownership_scheme.rb @@ -7,7 +7,7 @@ class Form::Sales::Questions::OwnershipScheme < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" }, "2" => { "value" => "Yes - a discounted ownership scheme" }, diff --git a/app/models/form/sales/questions/person_relationship_to_buyer_1.rb b/app/models/form/sales/questions/person_relationship_to_buyer_1.rb index af3f2a78b..9ac0791a4 100644 --- a/app/models/form/sales/questions/person_relationship_to_buyer_1.rb +++ b/app/models/form/sales/questions/person_relationship_to_buyer_1.rb @@ -16,7 +16,7 @@ class Form::Sales::Questions::PersonRelationshipToBuyer1 < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "P" => { "value" => "Partner" }, "C" => { "value" => "Child" }, diff --git a/app/models/form/sales/questions/privacy_notice.rb b/app/models/form/sales/questions/privacy_notice.rb index 57f77041b..5e73e7a3a 100644 --- a/app/models/form/sales/questions/privacy_notice.rb +++ b/app/models/form/sales/questions/privacy_notice.rb @@ -10,7 +10,7 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question end def answer_options - declaration_text = if form.start_year_after_2024? + declaration_text = if form.start_year_2024_or_later? "The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen or been given access to the MHCLG privacy notice" else "The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen the MHCLG privacy notice" @@ -21,7 +21,7 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question def unanswered_error_message buyer_or_buyers = @joint_purchase ? "buyers" : "buyer" - if form.start_year_after_2024? + if form.start_year_2024_or_later? I18n.t("validations.privacynotice.missing.post_2024", buyer_or_buyers:) else I18n.t("validations.privacynotice.missing.pre_2024", buyer_or_buyers:) diff --git a/app/models/form/sales/questions/uprn_confirmation.rb b/app/models/form/sales/questions/uprn_confirmation.rb index 94c1afa36..fed35f665 100644 --- a/app/models/form/sales/questions/uprn_confirmation.rb +++ b/app/models/form/sales/questions/uprn_confirmation.rb @@ -6,7 +6,7 @@ class Form::Sales::Questions::UprnConfirmation < ::Form::Question end def answer_options - if form.start_year_after_2024? + if form.start_year_2024_or_later? { "1" => { "value" => "Yes" }, "0" => { "value" => "No, I want to search for the address instead" }, diff --git a/app/models/form/sales/subsections/household_characteristics.rb b/app/models/form/sales/subsections/household_characteristics.rb index afbbe4278..f1f01ba62 100644 --- a/app/models/form/sales/subsections/household_characteristics.rb +++ b/app/models/form/sales/subsections/household_characteristics.rb @@ -8,13 +8,13 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection def pages @pages ||= [ - (Form::Sales::Pages::BuyerInterview.new("buyer_interview_joint_purchase", nil, self, joint_purchase: true) unless form.start_year_after_2024?), - (Form::Sales::Pages::BuyerInterview.new("buyer_interview", nil, self, joint_purchase: false) unless form.start_year_after_2024?), - (Form::Sales::Pages::PrivacyNotice.new("privacy_notice_joint_purchase", nil, self, joint_purchase: true) unless form.start_year_after_2024?), - (Form::Sales::Pages::PrivacyNotice.new("privacy_notice", nil, self, joint_purchase: false) unless form.start_year_after_2024?), + (Form::Sales::Pages::BuyerInterview.new("buyer_interview_joint_purchase", nil, self, joint_purchase: true) unless form.start_year_2024_or_later?), + (Form::Sales::Pages::BuyerInterview.new("buyer_interview", nil, self, joint_purchase: false) unless form.start_year_2024_or_later?), + (Form::Sales::Pages::PrivacyNotice.new("privacy_notice_joint_purchase", nil, self, joint_purchase: true) unless form.start_year_2024_or_later?), + (Form::Sales::Pages::PrivacyNotice.new("privacy_notice", nil, self, joint_purchase: false) unless form.start_year_2024_or_later?), Form::Sales::Pages::Age1.new(nil, nil, self), Form::Sales::Pages::RetirementValueCheck.new("age_1_retirement_value_check", nil, self, person_index: 1), - (Form::Sales::Pages::NotRetiredValueCheck.new("age_1_not_retired_value_check", nil, self, person_index: 1) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("age_1_not_retired_value_check", nil, self, person_index: 1) if form.start_year_2024_or_later?), Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck.new("age_1_old_persons_shared_ownership_joint_purchase_value_check", nil, self, joint_purchase: true), Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck.new("age_1_old_persons_shared_ownership_value_check", nil, self, joint_purchase: false), Form::Sales::Pages::GenderIdentity1.new(nil, nil, self), @@ -27,7 +27,7 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Sales::Pages::Buyer1Nationality.new(nil, nil, self), Form::Sales::Pages::Buyer1WorkingSituation.new(nil, nil, self), Form::Sales::Pages::RetirementValueCheck.new("working_situation_1_retirement_value_check", nil, self, person_index: 1), - (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_1_not_retired_value_check", nil, self, person_index: 1) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_1_not_retired_value_check", nil, self, person_index: 1) if form.start_year_2024_or_later?), Form::Sales::Pages::Buyer1IncomeMinValueCheck.new("working_situation_buyer_1_income_min_value_check", nil, self), Form::Sales::Pages::Buyer1LiveInProperty.new(nil, nil, self), Form::Sales::Pages::BuyerLiveInValueCheck.new("buyer_1_live_in_property_value_check", nil, self, person_index: 1), @@ -37,13 +37,13 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck.new("age_2_old_persons_shared_ownership_joint_purchase_value_check", nil, self, joint_purchase: true), Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck.new("age_2_old_persons_shared_ownership_value_check", nil, self, joint_purchase: false), Form::Sales::Pages::RetirementValueCheck.new("age_2_buyer_retirement_value_check", nil, self, person_index: 2), - (Form::Sales::Pages::NotRetiredValueCheck.new("age_2_buyer_not_retired_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("age_2_buyer_not_retired_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_age_student_not_child_value_check", nil, self, person_index: 2), Form::Sales::Pages::GenderIdentity2.new(nil, nil, self), buyer_2_ethnicity_nationality_pages, Form::Sales::Pages::Buyer2WorkingSituation.new(nil, nil, self), Form::Sales::Pages::RetirementValueCheck.new("working_situation_2_retirement_value_check_joint_purchase", nil, self, person_index: 2), - (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_2_not_retired_value_check_joint_purchase", nil, self, person_index: 2) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_2_not_retired_value_check_joint_purchase", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::Buyer2IncomeMinValueCheck.new("working_situation_buyer_2_income_min_value_check", nil, self), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_working_situation_student_not_child_value_check", nil, self, person_index: 2), Form::Sales::Pages::Buyer2LiveInProperty.new(nil, nil, self), @@ -52,78 +52,78 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Sales::Pages::NumberOfOthersInProperty.new("number_of_others_in_property_joint_purchase", nil, self, joint_purchase: true), Form::Sales::Pages::PersonKnown.new("person_2_known", nil, self, person_index: 2), Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_2_relationship_to_buyer_1", nil, self, person_index: 2), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), - (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_2_multiple_partners_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), + (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_2_multiple_partners_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_2_student_not_child_value_check", nil, self, person_index: 2), Form::Sales::Pages::PersonAge.new("person_2_age", nil, self, person_index: 2), Form::Sales::Pages::RetirementValueCheck.new("age_2_retirement_value_check", nil, self, person_index: 2), - (Form::Sales::Pages::NotRetiredValueCheck.new("age_2_not_retired_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("age_2_not_retired_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_2_student_not_child_value_check", nil, self, person_index: 2), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_2_gender_identity", nil, self, person_index: 2), Form::Sales::Pages::PersonWorkingSituation.new("person_2_working_situation", nil, self, person_index: 2), Form::Sales::Pages::RetirementValueCheck.new("working_situation_2_retirement_value_check", nil, self, person_index: 2), - (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_2_not_retired_value_check", nil, self, person_index: 2) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_2_not_retired_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_2_student_not_child_value_check", nil, self, person_index: 2), Form::Sales::Pages::PersonKnown.new("person_3_known", nil, self, person_index: 3), Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_3_relationship_to_buyer_1", nil, self, person_index: 3), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_after_2024?), - (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_3_multiple_partners_value_check", nil, self, person_index: 3) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), + (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_3_multiple_partners_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_3_student_not_child_value_check", nil, self, person_index: 3), Form::Sales::Pages::PersonAge.new("person_3_age", nil, self, person_index: 3), Form::Sales::Pages::RetirementValueCheck.new("age_3_retirement_value_check", nil, self, person_index: 3), - (Form::Sales::Pages::NotRetiredValueCheck.new("age_3_not_retired_value_check", nil, self, person_index: 3) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("age_3_not_retired_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_3_student_not_child_value_check", nil, self, person_index: 3), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_3_gender_identity", nil, self, person_index: 3), Form::Sales::Pages::PersonWorkingSituation.new("person_3_working_situation", nil, self, person_index: 3), Form::Sales::Pages::RetirementValueCheck.new("working_situation_3_retirement_value_check", nil, self, person_index: 3), - (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_3_not_retired_value_check", nil, self, person_index: 3) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_3_not_retired_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_3_student_not_child_value_check", nil, self, person_index: 3), Form::Sales::Pages::PersonKnown.new("person_4_known", nil, self, person_index: 4), Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_4_relationship_to_buyer_1", nil, self, person_index: 4), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_after_2024?), - (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_4_multiple_partners_value_check", nil, self, person_index: 4) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), + (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_4_multiple_partners_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_4_student_not_child_value_check", nil, self, person_index: 4), Form::Sales::Pages::PersonAge.new("person_4_age", nil, self, person_index: 4), Form::Sales::Pages::RetirementValueCheck.new("age_4_retirement_value_check", nil, self, person_index: 4), - (Form::Sales::Pages::NotRetiredValueCheck.new("age_4_not_retired_value_check", nil, self, person_index: 4) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("age_4_not_retired_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_4_student_not_child_value_check", nil, self, person_index: 4), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_4_gender_identity", nil, self, person_index: 4), Form::Sales::Pages::PersonWorkingSituation.new("person_4_working_situation", nil, self, person_index: 4), Form::Sales::Pages::RetirementValueCheck.new("working_situation_4_retirement_value_check", nil, self, person_index: 4), - (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_4_not_retired_value_check", nil, self, person_index: 4) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_4_not_retired_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_4_student_not_child_value_check", nil, self, person_index: 4), Form::Sales::Pages::PersonKnown.new("person_5_known", nil, self, person_index: 5), Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_5_relationship_to_buyer_1", nil, self, person_index: 5), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_after_2024?), - (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_5_multiple_partners_value_check", nil, self, person_index: 5) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), + (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_5_multiple_partners_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_5_student_not_child_value_check", nil, self, person_index: 5), Form::Sales::Pages::PersonAge.new("person_5_age", nil, self, person_index: 5), Form::Sales::Pages::RetirementValueCheck.new("age_5_retirement_value_check", nil, self, person_index: 5), - (Form::Sales::Pages::NotRetiredValueCheck.new("age_5_not_retired_value_check", nil, self, person_index: 5) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("age_5_not_retired_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_5_student_not_child_value_check", nil, self, person_index: 5), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_5_gender_identity", nil, self, person_index: 5), Form::Sales::Pages::PersonWorkingSituation.new("person_5_working_situation", nil, self, person_index: 5), Form::Sales::Pages::RetirementValueCheck.new("working_situation_5_retirement_value_check", nil, self, person_index: 5), - (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_5_not_retired_value_check", nil, self, person_index: 5) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_5_not_retired_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_5_student_not_child_value_check", nil, self, person_index: 5), Form::Sales::Pages::PersonKnown.new("person_6_known", nil, self, person_index: 6), Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_6_relationship_to_buyer_1", nil, self, person_index: 6), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_after_2024?), - (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_6_multiple_partners_value_check", nil, self, person_index: 6) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), + (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_6_multiple_partners_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_6_student_not_child_value_check", nil, self, person_index: 6), Form::Sales::Pages::PersonAge.new("person_6_age", nil, self, person_index: 6), Form::Sales::Pages::RetirementValueCheck.new("age_6_retirement_value_check", nil, self, person_index: 6), - (Form::Sales::Pages::NotRetiredValueCheck.new("age_6_not_retired_value_check", nil, self, person_index: 6) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("age_6_not_retired_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_6_student_not_child_value_check", nil, self, person_index: 6), - (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_after_2024?), + (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_6_gender_identity", nil, self, person_index: 6), Form::Sales::Pages::PersonWorkingSituation.new("person_6_working_situation", nil, self, person_index: 6), Form::Sales::Pages::RetirementValueCheck.new("working_situation_6_retirement_value_check", nil, self, person_index: 6), - (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_6_not_retired_value_check", nil, self, person_index: 6) if form.start_year_after_2024?), + (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_6_not_retired_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_6_student_not_child_value_check", nil, self, person_index: 6), ].flatten.compact end diff --git a/app/models/form/sales/subsections/outright_sale.rb b/app/models/form/sales/subsections/outright_sale.rb index 6b29313a1..af63c8179 100644 --- a/app/models/form/sales/subsections/outright_sale.rb +++ b/app/models/form/sales/subsections/outright_sale.rb @@ -14,8 +14,8 @@ class Form::Sales::Subsections::OutrightSale < ::Form::Subsection Form::Sales::Pages::MortgageValueCheck.new("outright_sale_mortgage_used_mortgage_value_check", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self, ownershipsch: 3), Form::Sales::Pages::MortgageValueCheck.new("outright_sale_mortgage_amount_mortgage_value_check", nil, self), - (Form::Sales::Pages::MortgageLender.new("mortgage_lender_outright_sale", nil, self, ownershipsch: 3) unless form.start_year_after_2024?), - (Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_outright_sale", nil, self, ownershipsch: 3) unless form.start_year_after_2024?), + (Form::Sales::Pages::MortgageLender.new("mortgage_lender_outright_sale", nil, self, ownershipsch: 3) unless form.start_year_2024_or_later?), + (Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_outright_sale", nil, self, ownershipsch: 3) unless form.start_year_2024_or_later?), Form::Sales::Pages::MortgageLength.new("mortgage_length_outright_sale", nil, self, ownershipsch: 3), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_outright_sale", nil, self, ownershipsch: 3), Form::Sales::Pages::Deposit.new("deposit_outright_sale", nil, self, ownershipsch: 3, optional: false), diff --git a/app/models/form/sales/subsections/property_information.rb b/app/models/form/sales/subsections/property_information.rb index c59c159ae..32df98af5 100644 --- a/app/models/form/sales/subsections/property_information.rb +++ b/app/models/form/sales/subsections/property_information.rb @@ -21,7 +21,7 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection end def uprn_questions - if form.start_year_after_2024? + if form.start_year_2024_or_later? [ Form::Sales::Pages::Uprn.new(nil, nil, self), Form::Sales::Pages::UprnConfirmation.new(nil, nil, self), diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index f954e24e6..de623e769 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -20,10 +20,10 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection Form::Sales::Pages::BuyerLive.new(nil, nil, self), Form::Sales::Pages::JointPurchase.new(nil, nil, self), Form::Sales::Pages::NumberJointBuyers.new(nil, nil, self), - (Form::Sales::Pages::BuyerInterview.new("buyer_interview_joint_purchase", nil, self, joint_purchase: true) if form.start_year_after_2024?), - (Form::Sales::Pages::BuyerInterview.new("buyer_interview", nil, self, joint_purchase: false) if form.start_year_after_2024?), - (Form::Sales::Pages::PrivacyNotice.new("privacy_notice_joint_purchase", nil, self, joint_purchase: true) if form.start_year_after_2024?), - (Form::Sales::Pages::PrivacyNotice.new("privacy_notice", nil, self, joint_purchase: false) if form.start_year_after_2024?), + (Form::Sales::Pages::BuyerInterview.new("buyer_interview_joint_purchase", nil, self, joint_purchase: true) if form.start_year_2024_or_later?), + (Form::Sales::Pages::BuyerInterview.new("buyer_interview", nil, self, joint_purchase: false) if form.start_year_2024_or_later?), + (Form::Sales::Pages::PrivacyNotice.new("privacy_notice_joint_purchase", nil, self, joint_purchase: true) if form.start_year_2024_or_later?), + (Form::Sales::Pages::PrivacyNotice.new("privacy_notice", nil, self, joint_purchase: false) if form.start_year_2024_or_later?), ].flatten.compact end end diff --git a/app/models/form/sales/subsections/shared_ownership_scheme.rb b/app/models/form/sales/subsections/shared_ownership_scheme.rb index c955929dc..3fba8ef70 100644 --- a/app/models/form/sales/subsections/shared_ownership_scheme.rb +++ b/app/models/form/sales/subsections/shared_ownership_scheme.rb @@ -40,11 +40,11 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection Form::Sales::Pages::MortgageLength.new("mortgage_length_shared_ownership", nil, self, ownershipsch: 1), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_shared_ownership", nil, self, ownershipsch: 1), Form::Sales::Pages::Deposit.new("deposit_shared_ownership", nil, self, ownershipsch: 1, optional: false), - (Form::Sales::Pages::Deposit.new("deposit_shared_ownership_optional", nil, self, ownershipsch: 1, optional: true) if form.start_year_after_2024?), + (Form::Sales::Pages::Deposit.new("deposit_shared_ownership_optional", nil, self, ownershipsch: 1, optional: true) if form.start_year_2024_or_later?), Form::Sales::Pages::DepositValueCheck.new("deposit_joint_purchase_value_check", nil, self, joint_purchase: true), Form::Sales::Pages::DepositValueCheck.new("deposit_value_check", nil, self, joint_purchase: false), Form::Sales::Pages::DepositDiscount.new("deposit_discount", nil, self, optional: false), - (Form::Sales::Pages::DepositDiscount.new("deposit_discount_optional", nil, self, optional: true) if form.start_year_after_2024?), + (Form::Sales::Pages::DepositDiscount.new("deposit_discount_optional", nil, self, optional: true) if form.start_year_2024_or_later?), Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_deposit_value_check", nil, self), Form::Sales::Pages::MonthlyRent.new(nil, nil, self), Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_shared_ownership", nil, self, ownershipsch: 1), diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 7cab576c4..d8732c3ea 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -391,7 +391,7 @@ class LettingsLog < Log end def is_beds_inferred? - form.start_year_after_2024? && is_bedsit? + form.start_year_2024_or_later? && is_bedsit? end def is_shared_housing? @@ -899,7 +899,7 @@ private def should_process_address_change? return unless uprn_selection || select_best_address_match return unless startdate - return unless form.start_year_after_2024? + return unless form.start_year_2024_or_later? if select_best_address_match address_line1_input.present? && postcode_full_input.present? diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index aca80ef94..23438142f 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -131,7 +131,7 @@ class SalesLog < Log not_required << "proplen" if proplen_optional? not_required << "mortlen" if mortlen_optional? not_required << "frombeds" if frombeds_optional? - not_required << "deposit" if form.start_year_after_2024? && stairowned_100? + not_required << "deposit" if form.start_year_2024_or_later? && stairowned_100? not_required |= %w[address_line2 county postcode_full] if saledate && collection_start_year_for_date(saledate) >= 2023 @@ -453,7 +453,7 @@ class SalesLog < Log def should_process_address_change? return unless uprn_selection || select_best_address_match return unless saledate - return unless form.start_year_after_2024? + return unless form.start_year_2024_or_later? if select_best_address_match address_line1_input.present? && postcode_full_input.present? @@ -515,7 +515,7 @@ class SalesLog < Log end def soctenant_is_inferred? - form.start_year_after_2024? + form.start_year_2024_or_later? end def duplicates diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb index 8fe940ae5..626925631 100644 --- a/app/models/validations/household_validations.rb +++ b/app/models/validations/household_validations.rb @@ -35,7 +35,7 @@ module Validations::HouseholdValidations record.errors.add :reason, I18n.t("validations.household.reason.not_internal_transfer") end - return unless record.form.start_year_after_2024? + return unless record.form.start_year_2024_or_later? if record.reason == 20 && PHRASES_INDICATING_HOMELESSNESS_REGEX.match?(record.reasonother) record.errors.add :reason, I18n.t("validations.household.reason.other_not_settled") @@ -56,7 +56,7 @@ module Validations::HouseholdValidations end def validate_person_1_economic(record) - return unless record.age1 && record.ecstat1 && !record.form.start_year_after_2024? + return unless record.age1 && record.ecstat1 && !record.form.start_year_2024_or_later? if record.age1 < 16 && !economic_status_is_child_other_or_refused?(record.ecstat1) record.errors.add "ecstat1", I18n.t("validations.household.ecstat.child_under_16", person_num: 1) @@ -74,7 +74,7 @@ module Validations::HouseholdValidations economic_status = record.public_send("ecstat#{person_num}") next unless age && economic_status - if age < 16 && !economic_status_is_child_other_or_refused?(economic_status) && !record.form.start_year_after_2024? + if age < 16 && !economic_status_is_child_other_or_refused?(economic_status) && !record.form.start_year_2024_or_later? record.errors.add "ecstat#{person_num}", I18n.t("validations.household.ecstat.child_under_16", person_num:) record.errors.add "age#{person_num}", I18n.t("validations.household.age.child_under_16_ecstat", person_num:) end @@ -86,7 +86,7 @@ module Validations::HouseholdValidations end def validate_person_age_matches_relationship(record) - return unless record.startdate && !record.form.start_year_after_2024? + return unless record.startdate && !record.form.start_year_2024_or_later? (2..8).each do |person_num| age = record.public_send("age#{person_num}") @@ -101,7 +101,7 @@ module Validations::HouseholdValidations end def validate_person_age_and_relationship_matches_economic_status(record) - return unless record.startdate && !record.form.start_year_after_2024? + return unless record.startdate && !record.form.start_year_2024_or_later? (2..8).each do |person_num| age = record.public_send("age#{person_num}") diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index 52afecb49..e0246ff1f 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -35,7 +35,7 @@ module Validations::PropertyValidations def validate_shared_housing_rooms(record) return unless record.unittype_gn - if record.is_bedsit? && record.beds != 1 && record.beds.present? && !record.form.start_year_after_2024? + if record.is_bedsit? && record.beds != 1 && record.beds.present? && !record.form.start_year_2024_or_later? record.errors.add :unittype_gn, I18n.t("validations.property.unittype_gn.one_bedroom_bedsit") record.errors.add :beds, I18n.t("validations.property.unittype_gn.one_bedroom_bedsit") end diff --git a/app/models/validations/sales/financial_validations.rb b/app/models/validations/sales/financial_validations.rb index 9a119475f..c1046e035 100644 --- a/app/models/validations/sales/financial_validations.rb +++ b/app/models/validations/sales/financial_validations.rb @@ -54,7 +54,7 @@ module Validations::Sales::FinancialValidations def validate_percentage_bought_not_equal_percentage_owned(record) return unless record.stairbought && record.stairowned - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? if record.stairbought == record.stairowned record.errors.add :stairbought, I18n.t("validations.financial.staircasing.percentage_bought_equal_percentage_owned", stairbought: sprintf("%g", record.stairbought), stairowned: sprintf("%g", record.stairowned)) @@ -105,7 +105,7 @@ module Validations::Sales::FinancialValidations def validate_equity_less_than_staircase_difference(record) return unless record.equity && record.stairbought && record.stairowned - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? if record.equity > record.stairowned - record.stairbought formatted_equity = sprintf("%g", record.equity) diff --git a/app/models/validations/sales/household_validations.rb b/app/models/validations/sales/household_validations.rb index fb1ea65c2..23b2e9ee1 100644 --- a/app/models/validations/sales/household_validations.rb +++ b/app/models/validations/sales/household_validations.rb @@ -16,7 +16,7 @@ module Validations::Sales::HouseholdValidations end def validate_buyer1_previous_tenure(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? return unless record.discounted_ownership_sale? && record.prevten if [3, 4, 5, 6, 7, 9, 0].include?(record.prevten) @@ -26,7 +26,7 @@ module Validations::Sales::HouseholdValidations end def validate_person_age_matches_relationship(record) - return unless record.saledate && !record.form.start_year_after_2024? + return unless record.saledate && !record.form.start_year_2024_or_later? (2..6).each do |person_num| age = record.public_send("age#{person_num}") @@ -44,7 +44,7 @@ module Validations::Sales::HouseholdValidations end def validate_person_age_and_relationship_matches_economic_status(record) - return unless record.saledate && !record.form.start_year_after_2024? + return unless record.saledate && !record.form.start_year_2024_or_later? (2..6).each do |person_num| age = record.public_send("age#{person_num}") @@ -77,7 +77,7 @@ module Validations::Sales::HouseholdValidations economic_status = record.public_send("ecstat#{person_num}") next unless age && economic_status - if age < 16 && !economic_status_is_child_other_or_refused?(economic_status) && !record.form.start_year_after_2024? + if age < 16 && !economic_status_is_child_other_or_refused?(economic_status) && !record.form.start_year_2024_or_later? record.errors.add "ecstat#{person_num}", I18n.t("validations.sales.household.ecstat.child_under_16", person_num:) record.errors.add "age#{person_num}", I18n.t("validations.sales.household.age.child_under_16_ecstat", person_num:) end @@ -89,7 +89,7 @@ module Validations::Sales::HouseholdValidations end def validate_child_12_years_younger(record) - return unless record.saledate && !record.form.start_year_after_2024? + return unless record.saledate && !record.form.start_year_2024_or_later? (2..6).each do |person_num| buyer_1_age = record.public_send("age1") @@ -106,7 +106,7 @@ module Validations::Sales::HouseholdValidations end def validate_buyer_not_child(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? record.errors.add "ecstat1", I18n.t("validations.sales.household.ecstat1.buyer_cannot_be_child") if person_is_economic_child?(record.ecstat1) record.errors.add "ecstat2", I18n.t("validations.sales.household.ecstat2.buyer_cannot_be_child") if person_is_economic_child?(record.ecstat2) && record.joint_purchase? diff --git a/app/models/validations/sales/property_validations.rb b/app/models/validations/sales/property_validations.rb index 59d616c9a..c4a42c630 100644 --- a/app/models/validations/sales/property_validations.rb +++ b/app/models/validations/sales/property_validations.rb @@ -1,6 +1,6 @@ module Validations::Sales::PropertyValidations def validate_postcodes_match_if_discounted_ownership(record) - return unless record.saledate && !record.form.start_year_after_2024? + return unless record.saledate && !record.form.start_year_2024_or_later? return unless record.ppostcode_full.present? && record.postcode_full.present? if record.discounted_ownership_sale? && record.ppostcode_full != record.postcode_full diff --git a/app/models/validations/sales/sale_information_validations.rb b/app/models/validations/sales/sale_information_validations.rb index 700867e66..3c5e3f2b9 100644 --- a/app/models/validations/sales/sale_information_validations.rb +++ b/app/models/validations/sales/sale_information_validations.rb @@ -12,7 +12,7 @@ module Validations::Sales::SaleInformationValidations record.errors.add :saledate, I18n.t("validations.sales.sale_information.saledate.must_be_after_hodate") end - if record.saledate - record.hodate >= 3.years && record.form.start_year_after_2024? + if record.saledate - record.hodate >= 3.years && record.form.start_year_2024_or_later? record.errors.add :hodate, I18n.t("validations.sales.sale_information.hodate.must_be_less_than_3_years_from_saledate") record.errors.add :saledate, I18n.t("validations.sales.sale_information.saledate.must_be_less_than_3_years_from_hodate") end @@ -42,7 +42,7 @@ module Validations::Sales::SaleInformationValidations end def validate_discounted_ownership_value(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? return unless record.value && record.deposit && record.ownershipsch return unless record.mortgage || record.mortgageused == 2 || record.mortgageused == 3 return unless record.discount || record.grant || record.type == 29 @@ -65,7 +65,7 @@ module Validations::Sales::SaleInformationValidations end def validate_outright_sale_value_matches_mortgage_plus_deposit(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? return unless record.outright_sale? return unless record.mortgage_used? && record.mortgage return unless record.deposit && record.value @@ -96,7 +96,7 @@ module Validations::Sales::SaleInformationValidations end def validate_grant_amount(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? return unless record.grant && (record.type == 8 || record.type == 21) unless record.grant.between?(9_000, 16_000) @@ -106,7 +106,7 @@ module Validations::Sales::SaleInformationValidations def validate_stairbought(record) return unless record.stairbought && record.type - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? max_stairbought = case record.type when 30, 16, 28, 31, 32 @@ -124,7 +124,7 @@ module Validations::Sales::SaleInformationValidations end def validate_discount_and_value(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? return unless record.discount && record.value && record.la if record.london_property? && record.discount_value > 136_400 @@ -139,7 +139,7 @@ module Validations::Sales::SaleInformationValidations end def validate_non_staircasing_mortgage(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? return unless record.value && record.deposit && record.equity return unless record.shared_ownership_scheme? && record.type && record.mortgageused && record.is_not_staircasing? @@ -151,7 +151,7 @@ module Validations::Sales::SaleInformationValidations end def validate_staircasing_mortgage(record) - return unless record.saledate && record.form.start_year_after_2024? + return unless record.saledate && record.form.start_year_2024_or_later? return unless record.value && record.deposit && record.stairbought return unless record.shared_ownership_scheme? && record.type && record.mortgageused && record.is_staircase? @@ -334,7 +334,7 @@ module Validations::Sales::SaleInformationValidations if record.discounted_ownership_sale? record.errors.add :mortgageused, I18n.t("validations.invalid_option", question: "was a mortgage used for the purchase of this property?") end - if record.outright_sale? && record.saledate && !record.form.start_year_after_2024? + if record.outright_sale? && record.saledate && !record.form.start_year_2024_or_later? record.errors.add :mortgageused, I18n.t("validations.invalid_option", question: "was a mortgage used for the purchase of this property?") record.errors.add :saledate, I18n.t("validations.sales.sale_information.saledate.mortgage_used_year") end diff --git a/app/models/validations/sales/soft_validations.rb b/app/models/validations/sales/soft_validations.rb index fccd9bf83..fe05ec13c 100644 --- a/app/models/validations/sales/soft_validations.rb +++ b/app/models/validations/sales/soft_validations.rb @@ -68,7 +68,7 @@ module Validations::Sales::SoftValidations end def extra_borrowing_expected_but_not_reported? - return unless saledate && !form.start_year_after_2024? + return unless saledate && !form.start_year_2024_or_later? return unless extrabor && mortgage && deposit && value && discount extrabor != 1 && mortgage + deposit > value - value * discount / 100 @@ -118,7 +118,7 @@ module Validations::Sales::SoftValidations def grant_outside_common_range? return unless grant && type && saledate - return if form.start_year_after_2024? && (type == 21 || type == 8) + return if form.start_year_2024_or_later? && (type == 21 || type == 8) !grant.between?(9_000, 16_000) end diff --git a/app/models/validations/shared_validations.rb b/app/models/validations/shared_validations.rb index a2ae916c1..2eb5fff5a 100644 --- a/app/models/validations/shared_validations.rb +++ b/app/models/validations/shared_validations.rb @@ -126,7 +126,7 @@ module Validations::SharedValidations end def shared_validate_partner_count(record, max_people) - return if record.form.start_year_after_2024? + return if record.form.start_year_2024_or_later? partner_numbers = (2..max_people).select { |n| person_is_partner?(record["relat#{n}"]) } if partner_numbers.count > 1 diff --git a/app/services/exports/lettings_log_export_service.rb b/app/services/exports/lettings_log_export_service.rb index b21099a06..97f495e0c 100644 --- a/app/services/exports/lettings_log_export_service.rb +++ b/app/services/exports/lettings_log_export_service.rb @@ -146,8 +146,8 @@ module Exports field_name.starts_with?(details_known_prefix) || pattern_age.match(field_name) || !EXPORT_FIELDS.include?(field_name) || - (lettings_log.form.start_year_after_2024? && PRE_2024_EXPORT_FIELDS.include?(field_name)) || - (!lettings_log.form.start_year_after_2024? && POST_2024_EXPORT_FIELDS.include?(field_name)) + (lettings_log.form.start_year_2024_or_later? && PRE_2024_EXPORT_FIELDS.include?(field_name)) || + (!lettings_log.form.start_year_2024_or_later? && POST_2024_EXPORT_FIELDS.include?(field_name)) end def build_export_xml(lettings_logs) diff --git a/spec/models/form/lettings/pages/first_time_property_let_as_social_housing_spec.rb b/spec/models/form/lettings/pages/first_time_property_let_as_social_housing_spec.rb index b095af406..43dc70378 100644 --- a/spec/models/form/lettings/pages/first_time_property_let_as_social_housing_spec.rb +++ b/spec/models/form/lettings/pages/first_time_property_let_as_social_housing_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing, type: let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/pages/lead_tenant_ethnic_background_white_spec.rb b/spec/models/form/lettings/pages/lead_tenant_ethnic_background_white_spec.rb index 1f2986064..b75e57674 100644 --- a/spec/models/form/lettings/pages/lead_tenant_ethnic_background_white_spec.rb +++ b/spec/models/form/lettings/pages/lead_tenant_ethnic_background_white_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Pages::LeadTenantEthnicBackgroundWhite, type: :mo let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/pages/person_age_spec.rb b/spec/models/form/lettings/pages/person_age_spec.rb index dfcc82406..2043052fd 100644 --- a/spec/models/form/lettings/pages/person_age_spec.rb +++ b/spec/models/form/lettings/pages/person_age_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Form::Lettings::Pages::PersonAge, type: :model do subject(:page) { described_class.new(nil, page_definition, subsection, person_index:) } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: false)) } let(:person_index) { 2 } it "has correct subsection" do diff --git a/spec/models/form/lettings/pages/person_relationship_to_lead_spec.rb b/spec/models/form/lettings/pages/person_relationship_to_lead_spec.rb index a0ebb9cbc..829d55ad0 100644 --- a/spec/models/form/lettings/pages/person_relationship_to_lead_spec.rb +++ b/spec/models/form/lettings/pages/person_relationship_to_lead_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Form::Lettings::Pages::PersonRelationshipToLead, type: :model do subject(:page) { described_class.new(nil, page_definition, subsection, person_index:) } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: false)) } let(:person_index) { 2 } it "has correct subsection" do diff --git a/spec/models/form/lettings/pages/previous_local_authority_spec.rb b/spec/models/form/lettings/pages/previous_local_authority_spec.rb index 9e6d91be3..37ae11133 100644 --- a/spec/models/form/lettings/pages/previous_local_authority_spec.rb +++ b/spec/models/form/lettings/pages/previous_local_authority_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Pages::PreviousLocalAuthority, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/lettings/pages/previous_postcode_spec.rb b/spec/models/form/lettings/pages/previous_postcode_spec.rb index eba9af065..354f78a98 100644 --- a/spec/models/form/lettings/pages/previous_postcode_spec.rb +++ b/spec/models/form/lettings/pages/previous_postcode_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Pages::PreviousPostcode, type: :model do let(:page_id) { "previous_postcode" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/lettings/pages/property_local_authority_spec.rb b/spec/models/form/lettings/pages/property_local_authority_spec.rb index fe5363d97..75d680ddd 100644 --- a/spec/models/form/lettings/pages/property_local_authority_spec.rb +++ b/spec/models/form/lettings/pages/property_local_authority_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Form::Lettings::Pages::PropertyLocalAuthority, type: :model do context "with form before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "is routed to when la is not inferred and it is general needs log" do @@ -61,7 +61,7 @@ RSpec.describe Form::Lettings::Pages::PropertyLocalAuthority, type: :model do context "with form after 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "is routed to when la is not inferred, it is general needs log and address search has been given" do diff --git a/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb b/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb index 90da08fb6..8090c6ed4 100644 --- a/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Pages::PropertyWheelchairAccessible, type: :model let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1))) } before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct subsection" do diff --git a/spec/models/form/lettings/pages/renewal_spec.rb b/spec/models/form/lettings/pages/renewal_spec.rb index edeeaff1b..77ba3aec8 100644 --- a/spec/models/form/lettings/pages/renewal_spec.rb +++ b/spec/models/form/lettings/pages/renewal_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Pages::Renewal, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/pages/rent_type_spec.rb b/spec/models/form/lettings/pages/rent_type_spec.rb index 41dc0a1a9..3cec8e01e 100644 --- a/spec/models/form/lettings/pages/rent_type_spec.rb +++ b/spec/models/form/lettings/pages/rent_type_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Pages::RentType, type: :model do before do allow(subsection).to receive(:form).and_return(form) - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct subsection" do diff --git a/spec/models/form/lettings/pages/starter_tenancy_type_spec.rb b/spec/models/form/lettings/pages/starter_tenancy_type_spec.rb index 6842f7d3e..005b546a8 100644 --- a/spec/models/form/lettings/pages/starter_tenancy_type_spec.rb +++ b/spec/models/form/lettings/pages/starter_tenancy_type_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Pages::StarterTenancyType, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/pages/uprn_spec.rb b/spec/models/form/lettings/pages/uprn_spec.rb index 2ab83c76a..81f1aec40 100644 --- a/spec/models/form/lettings/pages/uprn_spec.rb +++ b/spec/models/form/lettings/pages/uprn_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Pages::Uprn, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(subsection).to receive(:form).and_return(form) end @@ -57,7 +57,7 @@ RSpec.describe Form::Lettings::Pages::Uprn, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "points to address search page" do diff --git a/spec/models/form/lettings/questions/age1_known_spec.rb b/spec/models/form/lettings/questions/age1_known_spec.rb index 6ec594359..94c36d3d5 100644 --- a/spec/models/form/lettings/questions/age1_known_spec.rb +++ b/spec/models/form/lettings/questions/age1_known_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Questions::Age1Known, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/age_spec.rb b/spec/models/form/lettings/questions/age_spec.rb index e456007f7..639f695fd 100644 --- a/spec/models/form/lettings/questions/age_spec.rb +++ b/spec/models/form/lettings/questions/age_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Form::Lettings::Questions::Age, type: :model do subject(:question) { described_class.new(nil, question_definition, page, person_index:) } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 4), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 4), start_year_2024_or_later?: false))) } let(:person_index) { 2 } it "has correct page" do diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index fe1ae882d..25705414c 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?) + allow(form).to receive(:start_year_2024_or_later?) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -33,7 +33,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do context "when the form year is before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has the correct answer_options" do @@ -57,7 +57,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do context "when the form year is >= 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/ethnic_white_spec.rb b/spec/models/form/lettings/questions/ethnic_white_spec.rb index 7857893a1..ab20dd8ca 100644 --- a/spec/models/form/lettings/questions/ethnic_white_spec.rb +++ b/spec/models/form/lettings/questions/ethnic_white_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::EthnicWhite, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -44,7 +44,7 @@ RSpec.describe Form::Lettings::Questions::EthnicWhite, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb b/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb index 7f38f0108..756f5e84e 100644 --- a/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb +++ b/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing, t let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -34,7 +34,7 @@ RSpec.describe Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing, t context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/gender_identity1_spec.rb b/spec/models/form/lettings/questions/gender_identity1_spec.rb index 2a943cbe0..19503ea33 100644 --- a/spec/models/form/lettings/questions/gender_identity1_spec.rb +++ b/spec/models/form/lettings/questions/gender_identity1_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Questions::GenderIdentity1, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } before do allow(page).to receive(:subsection).and_return(subsection) diff --git a/spec/models/form/lettings/questions/hb_spec.rb b/spec/models/form/lettings/questions/hb_spec.rb index ed8f19cd5..9a1477954 100644 --- a/spec/models/form/lettings/questions/hb_spec.rb +++ b/spec/models/form/lettings/questions/hb_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Hb, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/housingneeds_other_spec.rb b/spec/models/form/lettings/questions/housingneeds_other_spec.rb index f7be373e1..ead58bb35 100644 --- a/spec/models/form/lettings/questions/housingneeds_other_spec.rb +++ b/spec/models/form/lettings/questions/housingneeds_other_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::HousingneedsOther, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -42,7 +42,7 @@ RSpec.describe Form::Lettings::Questions::HousingneedsOther, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/is_carehome_spec.rb b/spec/models/form/lettings/questions/is_carehome_spec.rb index 958873599..b82ddeaeb 100644 --- a/spec/models/form/lettings/questions/is_carehome_spec.rb +++ b/spec/models/form/lettings/questions/is_carehome_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::IsCarehome, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -42,7 +42,7 @@ RSpec.describe Form::Lettings::Questions::IsCarehome, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options in the correct order" do diff --git a/spec/models/form/lettings/questions/joint_spec.rb b/spec/models/form/lettings/questions/joint_spec.rb index 1207d97d4..d856e9c18 100644 --- a/spec/models/form/lettings/questions/joint_spec.rb +++ b/spec/models/form/lettings/questions/joint_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Joint, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/layear_spec.rb b/spec/models/form/lettings/questions/layear_spec.rb index 04296beae..5ea537514 100644 --- a/spec/models/form/lettings/questions/layear_spec.rb +++ b/spec/models/form/lettings/questions/layear_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Layear, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -49,7 +49,7 @@ RSpec.describe Form::Lettings::Questions::Layear, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/letting_allocation_spec.rb b/spec/models/form/lettings/questions/letting_allocation_spec.rb index 63c750e5d..980c8fea5 100644 --- a/spec/models/form/lettings/questions/letting_allocation_spec.rb +++ b/spec/models/form/lettings/questions/letting_allocation_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::LettingAllocation, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -45,7 +45,7 @@ RSpec.describe Form::Lettings::Questions::LettingAllocation, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/person_relationship_spec.rb b/spec/models/form/lettings/questions/person_relationship_spec.rb index 20d05e316..0023c60ef 100644 --- a/spec/models/form/lettings/questions/person_relationship_spec.rb +++ b/spec/models/form/lettings/questions/person_relationship_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Form::Lettings::Questions::PersonRelationship, type: :model do subject(:question) { described_class.new(nil, question_definition, page, person_index:) } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 4), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 4), start_year_2024_or_later?: false))) } let(:person_index) { 2 } it "has correct page" do diff --git a/spec/models/form/lettings/questions/ppcodenk_spec.rb b/spec/models/form/lettings/questions/ppcodenk_spec.rb index 8a29b032d..7186875d3 100644 --- a/spec/models/form/lettings/questions/ppcodenk_spec.rb +++ b/spec/models/form/lettings/questions/ppcodenk_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Questions::Ppcodenk, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/previous_la_known_spec.rb b/spec/models/form/lettings/questions/previous_la_known_spec.rb index defb56bdf..f05d376ab 100644 --- a/spec/models/form/lettings/questions/previous_la_known_spec.rb +++ b/spec/models/form/lettings/questions/previous_la_known_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Questions::PreviousLaKnown, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/previous_let_type_spec.rb b/spec/models/form/lettings/questions/previous_let_type_spec.rb index 0739fe386..95c1451cd 100644 --- a/spec/models/form/lettings/questions/previous_let_type_spec.rb +++ b/spec/models/form/lettings/questions/previous_let_type_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -44,7 +44,7 @@ RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do context "with collection year on or after 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer options" do diff --git a/spec/models/form/lettings/questions/reason_renewal_spec.rb b/spec/models/form/lettings/questions/reason_renewal_spec.rb index 3cdff75e7..e58a33a21 100644 --- a/spec/models/form/lettings/questions/reason_renewal_spec.rb +++ b/spec/models/form/lettings/questions/reason_renewal_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::ReasonRenewal, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -54,7 +54,7 @@ RSpec.describe Form::Lettings::Questions::ReasonRenewal, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/reason_spec.rb b/spec/models/form/lettings/questions/reason_spec.rb index 0b82eca42..4b71ee176 100644 --- a/spec/models/form/lettings/questions/reason_spec.rb +++ b/spec/models/form/lettings/questions/reason_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Reason, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -84,7 +84,7 @@ RSpec.describe Form::Lettings::Questions::Reason, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/reasonpref_spec.rb b/spec/models/form/lettings/questions/reasonpref_spec.rb index 5957d4979..43326b7c0 100644 --- a/spec/models/form/lettings/questions/reasonpref_spec.rb +++ b/spec/models/form/lettings/questions/reasonpref_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Questions::Reasonpref, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/referral_prp_spec.rb b/spec/models/form/lettings/questions/referral_prp_spec.rb index e11bf250c..a10b6d383 100644 --- a/spec/models/form/lettings/questions/referral_prp_spec.rb +++ b/spec/models/form/lettings/questions/referral_prp_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::ReferralPrp, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -64,7 +64,7 @@ RSpec.describe Form::Lettings::Questions::ReferralPrp, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/referral_spec.rb b/spec/models/form/lettings/questions/referral_spec.rb index b3f526697..75e6c2f42 100644 --- a/spec/models/form/lettings/questions/referral_spec.rb +++ b/spec/models/form/lettings/questions/referral_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Referral, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -62,7 +62,7 @@ RSpec.describe Form::Lettings::Questions::Referral, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/referral_supported_housing_prp_spec.rb b/spec/models/form/lettings/questions/referral_supported_housing_prp_spec.rb index ab13acd26..3059c122d 100644 --- a/spec/models/form/lettings/questions/referral_supported_housing_prp_spec.rb +++ b/spec/models/form/lettings/questions/referral_supported_housing_prp_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::ReferralSupportedHousingPrp, type: :mo let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -64,7 +64,7 @@ RSpec.describe Form::Lettings::Questions::ReferralSupportedHousingPrp, type: :mo let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/referral_supported_housing_spec.rb b/spec/models/form/lettings/questions/referral_supported_housing_spec.rb index 5e05bf65b..5a4af55e5 100644 --- a/spec/models/form/lettings/questions/referral_supported_housing_spec.rb +++ b/spec/models/form/lettings/questions/referral_supported_housing_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::ReferralSupportedHousing, type: :model let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -62,7 +62,7 @@ RSpec.describe Form::Lettings::Questions::ReferralSupportedHousing, type: :model let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/renewal_spec.rb b/spec/models/form/lettings/questions/renewal_spec.rb index 27fe1bf86..af2c22c15 100644 --- a/spec/models/form/lettings/questions/renewal_spec.rb +++ b/spec/models/form/lettings/questions/renewal_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Renewal, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/rent_type_spec.rb b/spec/models/form/lettings/questions/rent_type_spec.rb index 0716cdbf7..7d45320ad 100644 --- a/spec/models/form/lettings/questions/rent_type_spec.rb +++ b/spec/models/form/lettings/questions/rent_type_spec.rb @@ -12,7 +12,7 @@ RSpec.describe Form::Lettings::Questions::RentType, type: :model do before do allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct page" do @@ -37,7 +37,7 @@ RSpec.describe Form::Lettings::Questions::RentType, type: :model do context "when 2023" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has the correct answer_options" do @@ -58,7 +58,7 @@ RSpec.describe Form::Lettings::Questions::RentType, type: :model do context "when 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/rsnvac_spec.rb b/spec/models/form/lettings/questions/rsnvac_spec.rb index 45469cebb..5eb37ddb5 100644 --- a/spec/models/form/lettings/questions/rsnvac_spec.rb +++ b/spec/models/form/lettings/questions/rsnvac_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::Rsnvac, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -78,7 +78,7 @@ RSpec.describe Form::Lettings::Questions::Rsnvac, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/scheme_id_spec.rb b/spec/models/form/lettings/questions/scheme_id_spec.rb index c490cded4..ba5734b3b 100644 --- a/spec/models/form/lettings/questions/scheme_id_spec.rb +++ b/spec/models/form/lettings/questions/scheme_id_spec.rb @@ -12,7 +12,7 @@ RSpec.describe Form::Lettings::Questions::SchemeId, type: :model do before do allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct page" do diff --git a/spec/models/form/lettings/questions/sheltered_spec.rb b/spec/models/form/lettings/questions/sheltered_spec.rb index 33b1007d2..1f21a92eb 100644 --- a/spec/models/form/lettings/questions/sheltered_spec.rb +++ b/spec/models/form/lettings/questions/sheltered_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Lettings::Questions::Sheltered, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -40,7 +40,7 @@ RSpec.describe Form::Lettings::Questions::Sheltered, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb b/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb index d3022dfcf..1100796c8 100644 --- a/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb +++ b/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Lettings::Questions::StarterTenancyType, type: :model do context "with 2023/24 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has the correct answer options" do @@ -50,7 +50,7 @@ RSpec.describe Form::Lettings::Questions::StarterTenancyType, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer options" do diff --git a/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb b/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb index 4bab9187a..ba9a72001 100644 --- a/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthAffordableRent, type: :mo let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb b/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb index a3f9c80e2..55b51ccfa 100644 --- a/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthIntermediateRent, type: : let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/lettings/questions/tenancy_type_spec.rb b/spec/models/form/lettings/questions/tenancy_type_spec.rb index 08818d3ea..82a5ae3e7 100644 --- a/spec/models/form/lettings/questions/tenancy_type_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_type_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -31,7 +31,7 @@ RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do context "with 2023/24 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has the correct answer options" do @@ -65,7 +65,7 @@ RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer options" do diff --git a/spec/models/form/lettings/questions/waityear_spec.rb b/spec/models/form/lettings/questions/waityear_spec.rb index 5f1f344b9..5d9a5b3a9 100644 --- a/spec/models/form/lettings/questions/waityear_spec.rb +++ b/spec/models/form/lettings/questions/waityear_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Lettings::Questions::Waityear, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -59,7 +59,7 @@ RSpec.describe Form::Lettings::Questions::Waityear, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/wheelchair_spec.rb b/spec/models/form/lettings/questions/wheelchair_spec.rb index 984a2209f..0a9226ada 100644 --- a/spec/models/form/lettings/questions/wheelchair_spec.rb +++ b/spec/models/form/lettings/questions/wheelchair_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Lettings::Questions::Wheelchair, type: :model do before do allow(page).to receive(:subsection).and_return(subsection) - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct page" do diff --git a/spec/models/form/lettings/subsections/household_characteristics_spec.rb b/spec/models/form/lettings/subsections/household_characteristics_spec.rb index e199f55d3..b97717077 100644 --- a/spec/models/form/lettings/subsections/household_characteristics_spec.rb +++ b/spec/models/form/lettings/subsections/household_characteristics_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod context "with start year before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -152,7 +152,7 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod context "with start year >= 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/lettings/subsections/household_situation_spec.rb b/spec/models/form/lettings/subsections/household_situation_spec.rb index dd6f20d89..b9f65dbdd 100644 --- a/spec/models/form/lettings/subsections/household_situation_spec.rb +++ b/spec/models/form/lettings/subsections/household_situation_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do context "with form year before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -48,7 +48,7 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do context "with form year >= 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/lettings/subsections/property_information_spec.rb b/spec/models/form/lettings/subsections/property_information_spec.rb index d333ff669..cc12f621a 100644 --- a/spec/models/form/lettings/subsections/property_information_spec.rb +++ b/spec/models/form/lettings/subsections/property_information_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do let(:form) { instance_double(Form, start_date:) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end context "when 2023" do @@ -51,7 +51,7 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do let(:start_date) { Time.utc(2024, 2, 8) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/lettings/subsections/setup_spec.rb b/spec/models/form/lettings/subsections/setup_spec.rb index 074f7ae5e..997f4d08e 100644 --- a/spec/models/form/lettings/subsections/setup_spec.rb +++ b/spec/models/form/lettings/subsections/setup_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Form::Lettings::Subsections::Setup, type: :model do context "with start year before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -43,7 +43,7 @@ RSpec.describe Form::Lettings::Subsections::Setup, type: :model do context "with start year >= 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/lettings/subsections/tenancy_information_spec.rb b/spec/models/form/lettings/subsections/tenancy_information_spec.rb index 0c69f89ab..fce8e57fb 100644 --- a/spec/models/form/lettings/subsections/tenancy_information_spec.rb +++ b/spec/models/form/lettings/subsections/tenancy_information_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do let(:form) { instance_double(Form, start_date:) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end context "when 2023" do @@ -33,7 +33,7 @@ RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do let(:start_date) { Time.utc(2024, 2, 8) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_arab_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_arab_spec.rb index 68328a5db..a5cf4dd07 100644 --- a/spec/models/form/sales/pages/buyer1_ethnic_background_arab_spec.rb +++ b/spec/models/form/sales/pages/buyer1_ethnic_background_arab_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundArab, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_asian_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_asian_spec.rb index b4c8a198d..c0eb8a108 100644 --- a/spec/models/form/sales/pages/buyer1_ethnic_background_asian_spec.rb +++ b/spec/models/form/sales/pages/buyer1_ethnic_background_asian_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundAsian, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_black_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_black_spec.rb index 7650f49fa..0a04ff806 100644 --- a/spec/models/form/sales/pages/buyer1_ethnic_background_black_spec.rb +++ b/spec/models/form/sales/pages/buyer1_ethnic_background_black_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundBlack, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_mixed_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_mixed_spec.rb index 42420774f..e7cae6445 100644 --- a/spec/models/form/sales/pages/buyer1_ethnic_background_mixed_spec.rb +++ b/spec/models/form/sales/pages/buyer1_ethnic_background_mixed_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundMixed, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_white_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_white_spec.rb index 79dddc53a..ff45cd2c3 100644 --- a/spec/models/form/sales/pages/buyer1_ethnic_background_white_spec.rb +++ b/spec/models/form/sales/pages/buyer1_ethnic_background_white_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundWhite, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/sales/pages/buyer1_ethnic_group_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_group_spec.rb index dcc90fe51..9a94fc0fd 100644 --- a/spec/models/form/sales/pages/buyer1_ethnic_group_spec.rb +++ b/spec/models/form/sales/pages/buyer1_ethnic_group_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1EthnicGroup, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer1_live_in_property_spec.rb b/spec/models/form/sales/pages/buyer1_live_in_property_spec.rb index 2f3c92aa7..edc53bd79 100644 --- a/spec/models/form/sales/pages/buyer1_live_in_property_spec.rb +++ b/spec/models/form/sales/pages/buyer1_live_in_property_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1LiveInProperty, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer1_nationality_spec.rb b/spec/models/form/sales/pages/buyer1_nationality_spec.rb index a9cb1e381..a84a44009 100644 --- a/spec/models/form/sales/pages/buyer1_nationality_spec.rb +++ b/spec/models/form/sales/pages/buyer1_nationality_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::Buyer1Nationality, type: :model do before do allow(subsection).to receive(:form).and_return(form) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct subsection" do @@ -33,7 +33,7 @@ RSpec.describe Form::Sales::Pages::Buyer1Nationality, type: :model do context "with year 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct questions" do diff --git a/spec/models/form/sales/pages/buyer1_working_situation_spec.rb b/spec/models/form/sales/pages/buyer1_working_situation_spec.rb index 2ae7f0f1e..fb8529967 100644 --- a/spec/models/form/sales/pages/buyer1_working_situation_spec.rb +++ b/spec/models/form/sales/pages/buyer1_working_situation_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1WorkingSituation, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer2_nationality_spec.rb b/spec/models/form/sales/pages/buyer2_nationality_spec.rb index 97b5f7caf..e01215d21 100644 --- a/spec/models/form/sales/pages/buyer2_nationality_spec.rb +++ b/spec/models/form/sales/pages/buyer2_nationality_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::Buyer2Nationality, type: :model do before do allow(subsection).to receive(:form).and_return(form) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct subsection" do @@ -42,7 +42,7 @@ RSpec.describe Form::Sales::Pages::Buyer2Nationality, type: :model do context "with year 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct questions" do diff --git a/spec/models/form/sales/pages/buyer2_relationship_to_buyer1_spec.rb b/spec/models/form/sales/pages/buyer2_relationship_to_buyer1_spec.rb index 96a67f5bf..6fbd835c5 100644 --- a/spec/models/form/sales/pages/buyer2_relationship_to_buyer1_spec.rb +++ b/spec/models/form/sales/pages/buyer2_relationship_to_buyer1_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer2RelationshipToBuyer1, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer_interview_spec.rb b/spec/models/form/sales/pages/buyer_interview_spec.rb index 24704526d..f7c6bbb70 100644 --- a/spec/models/form/sales/pages/buyer_interview_spec.rb +++ b/spec/models/form/sales/pages/buyer_interview_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::BuyerInterview, type: :model do let(:page_id) { "buyer_interview" } let(:page_definition) { nil } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } let(:subsection) { instance_double(Form::Subsection, form:, id: "setup") } it "has correct subsection" do @@ -45,7 +45,7 @@ RSpec.describe Form::Sales::Pages::BuyerInterview, type: :model do end context "when form is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } context "when there are joint buyers" do subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: true) } diff --git a/spec/models/form/sales/pages/buyer_live_spec.rb b/spec/models/form/sales/pages/buyer_live_spec.rb index dd237214c..ac5ac2c27 100644 --- a/spec/models/form/sales/pages/buyer_live_spec.rb +++ b/spec/models/form/sales/pages/buyer_live_spec.rb @@ -11,7 +11,7 @@ RSpec.describe Form::Sales::Pages::BuyerLive, type: :model do let(:form) { instance_double(Form, start_date: current_collection_start_date) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/sales/pages/buyer_previous_spec.rb b/spec/models/form/sales/pages/buyer_previous_spec.rb index d55243dec..8e1486ee6 100644 --- a/spec/models/form/sales/pages/buyer_previous_spec.rb +++ b/spec/models/form/sales/pages/buyer_previous_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Sales::Pages::BuyerPrevious, type: :model do let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection, depends_on: nil, enabled?: true, form:) } let(:start_date_after_2024) { false } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: start_date_after_2024, depends_on_met: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_date_after_2024, depends_on_met: true) } let(:joint_purchase) { false } it "has correct subsection" do diff --git a/spec/models/form/sales/pages/deposit_discount_spec.rb b/spec/models/form/sales/pages/deposit_discount_spec.rb index d183e379b..f94c46707 100644 --- a/spec/models/form/sales/pages/deposit_discount_spec.rb +++ b/spec/models/form/sales/pages/deposit_discount_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::DepositDiscount, type: :model do let(:subsection) { instance_double(Form::Subsection) } before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct subsection" do @@ -45,7 +45,7 @@ RSpec.describe Form::Sales::Pages::DepositDiscount, type: :model do context "when it's a 2024 form" do before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: true, start_date: Time.zone.local(2024, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: true, start_date: Time.zone.local(2024, 4, 1))) end it "has correct depends_on" do diff --git a/spec/models/form/sales/pages/deposit_spec.rb b/spec/models/form/sales/pages/deposit_spec.rb index b33604176..ea309bffc 100644 --- a/spec/models/form/sales/pages/deposit_spec.rb +++ b/spec/models/form/sales/pages/deposit_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Sales::Pages::Deposit, type: :model do let(:page_id) { nil } let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection, enabled?: true, depends_on: true) } - let(:form) { instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1), depends_on_met: true) } + let(:form) { instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1), depends_on_met: true) } let(:optional) { false } before do @@ -31,7 +31,7 @@ RSpec.describe Form::Sales::Pages::Deposit, type: :model do context "when routing with start year after 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end context "and optional is false" do @@ -131,7 +131,7 @@ RSpec.describe Form::Sales::Pages::Deposit, type: :model do context "when routing with start year before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end context "and optional is false" do diff --git a/spec/models/form/sales/pages/discount_spec.rb b/spec/models/form/sales/pages/discount_spec.rb index 4585b7f19..c9fb16095 100644 --- a/spec/models/form/sales/pages/discount_spec.rb +++ b/spec/models/form/sales/pages/discount_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::Discount, type: :model do let(:subsection) { instance_double(Form::Subsection) } before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct subsection" do diff --git a/spec/models/form/sales/pages/la_nominations_spec.rb b/spec/models/form/sales/pages/la_nominations_spec.rb index b69f88f1f..036e26092 100644 --- a/spec/models/form/sales/pages/la_nominations_spec.rb +++ b/spec/models/form/sales/pages/la_nominations_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::LaNominations, type: :model do let(:page_id) { nil } let(:page_definition) { nil } let(:start_year_after_2024) { false } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: start_year_after_2024) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_after_2024) } let(:subsection) { instance_double(Form::Subsection, form:) } before do diff --git a/spec/models/form/sales/pages/last_accommodation_la_spec.rb b/spec/models/form/sales/pages/last_accommodation_la_spec.rb index b73cf07f0..9cdd64957 100644 --- a/spec/models/form/sales/pages/last_accommodation_la_spec.rb +++ b/spec/models/form/sales/pages/last_accommodation_la_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Sales::Pages::LastAccommodationLa, type: :model do let(:page_id) { nil } let(:page_definition) { nil } let(:start_year_after_2024) { false } - let(:form) { instance_double(Form, depends_on_met: true, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: start_year_after_2024) } + let(:form) { instance_double(Form, depends_on_met: true, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_after_2024) } let(:subsection) { instance_double(Form::Subsection, form:, depends_on: nil, enabled?: true) } let(:log) { build(:sales_log, :completed) } diff --git a/spec/models/form/sales/pages/last_accommodation_spec.rb b/spec/models/form/sales/pages/last_accommodation_spec.rb index 8c3dbdbbf..fbc581b4b 100644 --- a/spec/models/form/sales/pages/last_accommodation_spec.rb +++ b/spec/models/form/sales/pages/last_accommodation_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::LastAccommodation, type: :model do let(:page_id) { nil } let(:page_definition) { nil } let(:start_year_after_2024) { false } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: start_year_after_2024) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_after_2024) } let(:subsection) { instance_double(Form::Subsection, form:, depends_on: nil) } it "has correct subsection" do diff --git a/spec/models/form/sales/pages/managing_organisation_spec.rb b/spec/models/form/sales/pages/managing_organisation_spec.rb index ea90add64..30383a1f5 100644 --- a/spec/models/form/sales/pages/managing_organisation_spec.rb +++ b/spec/models/form/sales/pages/managing_organisation_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Sales::Pages::ManagingOrganisation, type: :model do let(:page_id) { nil } let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection, form:) } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -103,7 +103,7 @@ RSpec.describe Form::Sales::Pages::ManagingOrganisation, type: :model do describe "#routed_to? with 2024 logs" do let(:log) { create(:sales_log) } let(:organisation) { create(:organisation) } - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } context "when user nil" do it "is not shown" do diff --git a/spec/models/form/sales/pages/person_relationship_to_buyer1_spec.rb b/spec/models/form/sales/pages/person_relationship_to_buyer1_spec.rb index 126f2f0b5..aeb196337 100644 --- a/spec/models/form/sales/pages/person_relationship_to_buyer1_spec.rb +++ b/spec/models/form/sales/pages/person_relationship_to_buyer1_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Form::Sales::Pages::PersonRelationshipToBuyer1, type: :model do subject(:page) { described_class.new(page_id, page_definition, subsection, person_index:) } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } let(:person_index) { 1 } let(:page_id) { "person_1_relationship_to_buyer_1" } diff --git a/spec/models/form/sales/pages/privacy_notice_spec.rb b/spec/models/form/sales/pages/privacy_notice_spec.rb index 7510e60d9..80be7ae66 100644 --- a/spec/models/form/sales/pages/privacy_notice_spec.rb +++ b/spec/models/form/sales/pages/privacy_notice_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do let(:page_id) { "privacy_notice" } let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection, id: "setup") } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } before do allow(subsection).to receive(:form).and_return(form) @@ -40,7 +40,7 @@ RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do end context "when the form start year is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } it "has the expected copy_key" do expect(page.copy_key).to eq("sales.setup.privacynotice.joint_purchase") @@ -64,7 +64,7 @@ RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do end context "when the form start year is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } it "has the expected copy_key" do expect(page.copy_key).to eq("sales.setup.privacynotice.not_joint_purchase") diff --git a/spec/models/form/sales/pages/property_local_authority_spec.rb b/spec/models/form/sales/pages/property_local_authority_spec.rb index faba75665..88d049bce 100644 --- a/spec/models/form/sales/pages/property_local_authority_spec.rb +++ b/spec/models/form/sales/pages/property_local_authority_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do context "with form before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "is routed to when la is not inferred" do @@ -60,7 +60,7 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do context "with form after 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "is routed to when la is not inferred and address search has been given" do diff --git a/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb b/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb index 9d60c5f3c..01dcb7ce7 100644 --- a/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::PropertyWheelchairAccessible, type: :model do let(:subsection) { instance_double(Form::Subsection) } before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct subsection" do diff --git a/spec/models/form/sales/pages/purchase_price_spec.rb b/spec/models/form/sales/pages/purchase_price_spec.rb index e5bfb176a..ad857ee9f 100644 --- a/spec/models/form/sales/pages/purchase_price_spec.rb +++ b/spec/models/form/sales/pages/purchase_price_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Pages::PurchasePrice, type: :model do let(:subsection) { instance_double(Form::Subsection) } before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct subsection" do diff --git a/spec/models/form/sales/pages/shared_ownership_type_spec.rb b/spec/models/form/sales/pages/shared_ownership_type_spec.rb index d12c49b57..e6ae7d55d 100644 --- a/spec/models/form/sales/pages/shared_ownership_type_spec.rb +++ b/spec/models/form/sales/pages/shared_ownership_type_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipType, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: current_collection_start_date, start_year_after_2024?: true)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: current_collection_start_date, start_year_2024_or_later?: true)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/uprn_spec.rb b/spec/models/form/sales/pages/uprn_spec.rb index 17ef3179b..03e1197bc 100644 --- a/spec/models/form/sales/pages/uprn_spec.rb +++ b/spec/models/form/sales/pages/uprn_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Form::Sales::Pages::Uprn, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(subsection).to receive(:form).and_return(form) end @@ -57,7 +57,7 @@ RSpec.describe Form::Sales::Pages::Uprn, type: :model do context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "points to address search page" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb index 593a525d2..c5f243745 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundArab, type: :model let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb index f49d64437..6cf9306b2 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundAsian, type: :model let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb index 6afe4eaf5..cb040ffbd 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundBlack, type: :model let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb index d6e51de58..aced8cb58 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundMixed, type: :model let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb index d08ece820..6aa547e8b 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundWhite, type: :model let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -44,7 +44,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundWhite, type: :model context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb index 0bdc6d9c0..8a859100d 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicGroup, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb b/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb index eccb172f7..038e0ce5d 100644 --- a/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb +++ b/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer1LiveInProperty, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer1_working_situation_spec.rb b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb index c99e64527..e25eb2aaf 100644 --- a/spec/models/form/sales/questions/buyer1_working_situation_spec.rb +++ b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb b/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb index 8d81e8897..6cab95147 100644 --- a/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb +++ b/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundWhite, type: :model let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -44,7 +44,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundWhite, type: :model context "with 2024/25 form" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb b/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb index 1d478faa9..99185a592 100644 --- a/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb +++ b/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::Buyer2RelationshipToBuyer1, type: :model let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/sales/questions/buyer_interview_spec.rb b/spec/models/form/sales/questions/buyer_interview_spec.rb index e2b39c50f..0db43407f 100644 --- a/spec/models/form/sales/questions/buyer_interview_spec.rb +++ b/spec/models/form/sales/questions/buyer_interview_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: true) } let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: "setup")) } it "has correct page" do @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do context "when the form start year is before 2024" do let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: "household_characteristics")) } - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 3, 1), start_year_after_2024?: false) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 3, 1), start_year_2024_or_later?: false) } it "has the expected copy_key" do expect(question.copy_key).to eq("sales.household_characteristics.noint.joint_purchase") @@ -44,7 +44,7 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do end context "when the form start year is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } it "has the expected copy_key" do expect(question.copy_key).to eq("sales.setup.noint.joint_purchase") @@ -57,7 +57,7 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do context "when the form start year is before 2024" do let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: "household_characteristics")) } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } it "has the expected copy_key" do expect(question.copy_key).to eq("sales.household_characteristics.noint.not_joint_purchase") @@ -65,7 +65,7 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do end context "when the form start year is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_after_2024?: true) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } it "has the expected copy_key" do expect(question.copy_key).to eq("sales.setup.noint.not_joint_purchase") diff --git a/spec/models/form/sales/questions/buyer_live_spec.rb b/spec/models/form/sales/questions/buyer_live_spec.rb index 12dfc8be6..4356db5dd 100644 --- a/spec/models/form/sales/questions/buyer_live_spec.rb +++ b/spec/models/form/sales/questions/buyer_live_spec.rb @@ -12,7 +12,7 @@ RSpec.describe Form::Sales::Questions::BuyerLive, type: :model do let(:form) { instance_double(Form, start_date: current_collection_start_date) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end diff --git a/spec/models/form/sales/questions/buyer_previous_spec.rb b/spec/models/form/sales/questions/buyer_previous_spec.rb index 8c37c2ff2..88204ad1a 100644 --- a/spec/models/form/sales/questions/buyer_previous_spec.rb +++ b/spec/models/form/sales/questions/buyer_previous_spec.rb @@ -48,7 +48,7 @@ RSpec.describe Form::Sales::Questions::BuyerPrevious, type: :model do context "when form year is before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "is not marked as derived" do @@ -58,7 +58,7 @@ RSpec.describe Form::Sales::Questions::BuyerPrevious, type: :model do context "when form year is >= 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "is marked as derived" do diff --git a/spec/models/form/sales/questions/discount_spec.rb b/spec/models/form/sales/questions/discount_spec.rb index 5037e2b4e..09c2fa076 100644 --- a/spec/models/form/sales/questions/discount_spec.rb +++ b/spec/models/form/sales/questions/discount_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::Discount, type: :model do before do allow(page).to receive(:subsection).and_return(subsection) - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct page" do @@ -47,7 +47,7 @@ RSpec.describe Form::Sales::Questions::Discount, type: :model do context "with form start year after 2024" do before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: true, start_date: Time.zone.local(2024, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: true, start_date: Time.zone.local(2024, 4, 1))) end it "has correct max" do diff --git a/spec/models/form/sales/questions/mortgage_lender_spec.rb b/spec/models/form/sales/questions/mortgage_lender_spec.rb index a7abd4c16..b4ce1bf86 100644 --- a/spec/models/form/sales/questions/mortgage_lender_spec.rb +++ b/spec/models/form/sales/questions/mortgage_lender_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?) + allow(form).to receive(:start_year_2024_or_later?) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -46,7 +46,7 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do context "when form year is before 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has the correct answer_options" do @@ -145,7 +145,7 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do context "when form year is >= 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/mortgageused_spec.rb b/spec/models/form/sales/questions/mortgageused_spec.rb index 7c37cbd78..e85238a4d 100644 --- a/spec/models/form/sales/questions/mortgageused_spec.rb +++ b/spec/models/form/sales/questions/mortgageused_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do context "and the saledate is before 24/25" do before do - allow(form).to receive(:start_year_after_2024?).and_return false + allow(form).to receive(:start_year_2024_or_later?).and_return false end it "does not show the don't know option" do @@ -45,7 +45,7 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do context "and the saledate is 24/25 or after" do before do - allow(form).to receive(:start_year_after_2024?).and_return true + allow(form).to receive(:start_year_2024_or_later?).and_return true end it "shows the don't know option" do diff --git a/spec/models/form/sales/questions/nationality_all_group_spec.rb b/spec/models/form/sales/questions/nationality_all_group_spec.rb index a88bf1867..4c2b2a39e 100644 --- a/spec/models/form/sales/questions/nationality_all_group_spec.rb +++ b/spec/models/form/sales/questions/nationality_all_group_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::NationalityAllGroup, type: :model do let(:buyer_index) { 1 } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } it "has correct page" do expect(question.page).to be page diff --git a/spec/models/form/sales/questions/number_joint_buyers_spec.rb b/spec/models/form/sales/questions/number_joint_buyers_spec.rb index 9529b3aac..bf53d7d88 100644 --- a/spec/models/form/sales/questions/number_joint_buyers_spec.rb +++ b/spec/models/form/sales/questions/number_joint_buyers_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::NumberJointBuyers, type: :model do before do allow(page).to receive(:subsection).and_return(subsection) - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct page" do diff --git a/spec/models/form/sales/questions/ownership_scheme_spec.rb b/spec/models/form/sales/questions/ownership_scheme_spec.rb index 99ec32684..222ec180d 100644 --- a/spec/models/form/sales/questions/ownership_scheme_spec.rb +++ b/spec/models/form/sales/questions/ownership_scheme_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -41,7 +41,7 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do context "with collection year on or after 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/person_age_spec.rb b/spec/models/form/sales/questions/person_age_spec.rb index 5faa046bb..772ee20e0 100644 --- a/spec/models/form/sales/questions/person_age_spec.rb +++ b/spec/models/form/sales/questions/person_age_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::PersonAge, type: :model do let(:question_id) { "age3" } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } let(:person_index) { 2 } it "has correct page" do diff --git a/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb b/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb index 32fb055cd..0bc00c179 100644 --- a/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb +++ b/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model let(:question_id) { "relat2" } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_after_2024?: false))) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } let(:person_index) { 2 } it "has correct page" do diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index 3f8c030b0..5f764c7af 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do - allow(form).to receive(:start_year_after_2024?) + allow(form).to receive(:start_year_2024_or_later?) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -35,7 +35,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do let(:subsection) { instance_double(Form::Subsection, id: "household_characteristics") } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end context "and there is a single buyer" do @@ -83,7 +83,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do context "when the form year is >= 2024" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end context "and there is a single buyer" do diff --git a/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb b/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb index 6b89deff2..a08a6d0f8 100644 --- a/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Form::Sales::Questions::PropertyWheelchairAccessible, type: :mode before do allow(page).to receive(:subsection).and_return(subsection) - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct page" do diff --git a/spec/models/form/sales/questions/shared_ownership_type_spec.rb b/spec/models/form/sales/questions/shared_ownership_type_spec.rb index 91cf6da9e..aa75b381a 100644 --- a/spec/models/form/sales/questions/shared_ownership_type_spec.rb +++ b/spec/models/form/sales/questions/shared_ownership_type_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do let(:page) { instance_double(Form::Page, subsection:) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct page" do @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do let(:start_date) { Time.zone.local(2023, 4, 2) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has the correct answer_options" do @@ -59,7 +59,7 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do context "when form start date is on or after 2024/25" do before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "shows shows correct top_guidance_partial" do diff --git a/spec/models/form/sales/subsections/household_characteristics_spec.rb b/spec/models/form/sales/subsections/household_characteristics_spec.rb index 7c6546d79..3eb5042d8 100644 --- a/spec/models/form/sales/subsections/household_characteristics_spec.rb +++ b/spec/models/form/sales/subsections/household_characteristics_spec.rb @@ -19,7 +19,7 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model context "with 2022/23 form" do before do allow(form).to receive(:start_date).and_return(Time.zone.local(2022, 4, 1)) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -120,7 +120,7 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model context "with 2023/24 form" do before do allow(form).to receive(:start_date).and_return(Time.zone.local(2023, 4, 1)) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -228,7 +228,7 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model context "with 2024/25 form" do before do allow(form).to receive(:start_date).and_return(Time.zone.local(2024, 4, 1)) - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/sales/subsections/outright_sale_spec.rb b/spec/models/form/sales/subsections/outright_sale_spec.rb index 0d28330f2..52941d0a9 100644 --- a/spec/models/form/sales/subsections/outright_sale_spec.rb +++ b/spec/models/form/sales/subsections/outright_sale_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Form::Sales::Subsections::OutrightSale, type: :model do context "when 2022" do before do allow(form).to receive(:start_date).and_return(Time.zone.local(2022, 2, 8)) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -51,7 +51,7 @@ RSpec.describe Form::Sales::Subsections::OutrightSale, type: :model do before do allow(form).to receive(:start_date).and_return(Time.zone.local(2023, 2, 8)) - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -80,7 +80,7 @@ RSpec.describe Form::Sales::Subsections::OutrightSale, type: :model do context "when 2024" do before do allow(form).to receive(:start_date).and_return(Time.zone.local(2024, 2, 8)) - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/sales/subsections/property_information_spec.rb b/spec/models/form/sales/subsections/property_information_spec.rb index 6e181f738..d29ee85fe 100644 --- a/spec/models/form/sales/subsections/property_information_spec.rb +++ b/spec/models/form/sales/subsections/property_information_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do let(:form) { instance_double(Form, start_date:) } before do - allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) end context "when 2023" do @@ -47,7 +47,7 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do let(:start_date) { Time.utc(2024, 2, 8) } before do - allow(form).to receive(:start_year_after_2024?).and_return(true) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 2d6612663..70d52977f 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do context "when start year is before 2024" do before do - allow(section.form).to receive(:start_year_after_2024?).and_return(false) + allow(section.form).to receive(:start_year_2024_or_later?).and_return(false) end it "has correct pages" do @@ -48,7 +48,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do context "when start year is >= 2024" do before do - allow(section.form).to receive(:start_year_after_2024?).and_return(true) + allow(section.form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do diff --git a/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb b/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb index 922281fd0..8c5674d0b 100644 --- a/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb +++ b/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Subsections::SharedOwnershipScheme, type: :model do let(:section) { instance_double(Form::Sales::Sections::SaleInformation) } before do - allow(section).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(section).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct section" do diff --git a/spec/models/validations/property_validations_spec.rb b/spec/models/validations/property_validations_spec.rb index 3f6f9877c..8cf484f91 100644 --- a/spec/models/validations/property_validations_spec.rb +++ b/spec/models/validations/property_validations_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Validations::PropertyValidations do context "and the log is from before 24/25" do it "adds an error" do - allow(log.form).to receive(:start_year_after_2024?).and_return false + allow(log.form).to receive(:start_year_2024_or_later?).and_return false property_validator.validate_shared_housing_rooms(log) @@ -76,7 +76,7 @@ RSpec.describe Validations::PropertyValidations do context "and the log is from before 24/25" do it "adds an error" do - allow(log.form).to receive(:start_year_after_2024?).and_return false + allow(log.form).to receive(:start_year_2024_or_later?).and_return false property_validator.validate_shared_housing_rooms(log) From 1ff5c0841a755eca9776bf5f567b6773e3cc2043 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:09:11 +0000 Subject: [PATCH 10/27] CLDC-3066++: Show filters button bug (#2759) * Ensure the app-filter-toggle class is always present regardless of the user's permissions, you can move it outside of the conditional logic --- app/components/create_log_actions_component.html.erb | 4 ++-- app/views/organisations/schemes.html.erb | 11 ++++++----- app/views/organisations/users.html.erb | 5 +++-- app/views/schemes/index.html.erb | 11 ++++++----- app/views/users/index.html.erb | 9 +++++---- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/components/create_log_actions_component.html.erb b/app/components/create_log_actions_component.html.erb index 2e88034d7..53e2bb57b 100644 --- a/app/components/create_log_actions_component.html.erb +++ b/app/components/create_log_actions_component.html.erb @@ -1,5 +1,5 @@ +
"> <% if display_actions? %> -
<%= govuk_button_to create_button_copy, create_button_href, class: "govuk-!-margin-right-3" %> <% unless user.support? %> <%= govuk_button_link_to upload_button_copy, upload_button_href, secondary: true %> @@ -7,5 +7,5 @@ <% if user.support? %> <%= govuk_button_link_to view_uploads_button_copy, view_uploads_button_href, secondary: true %> <% end %> -
<% end %> +
diff --git a/app/views/organisations/schemes.html.erb b/app/views/organisations/schemes.html.erb index 0fda1d359..a6f225bd8 100644 --- a/app/views/organisations/schemes.html.erb +++ b/app/views/organisations/schemes.html.erb @@ -22,11 +22,12 @@ <% end %>
- <% if SchemePolicy.new(current_user, nil).create? %> -
- <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> -
- <% end %> + <% display_actions = SchemePolicy.new(current_user, nil).create? %> +
"> + <% if display_actions %> + <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> + <% end %> +
<%= govuk_details( classes: "govuk-!-width-two-thirds", diff --git a/app/views/organisations/users.html.erb b/app/views/organisations/users.html.erb index 73a460276..109d8c24a 100644 --- a/app/views/organisations/users.html.erb +++ b/app/views/organisations/users.html.erb @@ -13,8 +13,9 @@ <% end %>
-
- <% if current_user.data_coordinator? || current_user.support? %> + <% display_actions = current_user.data_coordinator? || current_user.support? %> +
"> + <% if display_actions %> <%= govuk_button_link_to "Invite user", new_user_path(organisation_id: @organisation.id), html: { method: :get } %> <% end %>
diff --git a/app/views/schemes/index.html.erb b/app/views/schemes/index.html.erb index 9cbc95fdb..1ca69691e 100644 --- a/app/views/schemes/index.html.erb +++ b/app/views/schemes/index.html.erb @@ -6,11 +6,12 @@ <%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Supported housing schemes", sub: nil } : { main: "Supported housing schemes", sub: current_user.organisation.name } %>
- <% if SchemePolicy.new(current_user, nil).create? %> -
- <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> -
- <% end %> + <% display_actions = SchemePolicy.new(current_user, nil).create? %> +
"> + <% if display_actions %> + <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> + <% end %> +
<%= render partial: "schemes/scheme_filters" %>
<%= render SearchComponent.new(current_user:, search_label: "Search by postcode, scheme name, scheme code or location name", value: @searched) %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index dd454464d..47d714dbc 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -6,11 +6,12 @@ <%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Users", sub: nil } : { main: "Users", sub: current_user.organisation.name } %>
-<% if current_user.data_coordinator? || current_user.support? %> -
- <%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %> + <% display_actions = current_user.data_coordinator? || current_user.support? %> +
"> + <% if display_actions %> + <%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %> + <% end %>
-<% end %> <%= render partial: "users/user_filters" %>
<%= render SearchComponent.new(current_user:, search_label: "Search by name or email address", value: @searched) %> From 020b8a4f4c14eb7a4bb2e566b3d4ec19f85f0076 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:51:12 +0000 Subject: [PATCH 11/27] CLDC-3686 Extract lettings soft validations copy (#2735) * Extract household characteristics soft validations * Extract household needs soft validations * Extract household situation soft validations * Extract income and benefits soft validations * Extract property information soft validations * Update tests and 2024 soft validations * Update some test forms * Re-add sales validation * Update BU tests * Fixes * Change higher to longer * Update model test * Update model test * Add 2025 translations copied from 2024 * Update pregnancy and retirement copy --------- Co-authored-by: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Co-authored-by: Rachael Booth --- app/helpers/interruption_screen_helper.rb | 2 +- .../pages/care_home_charges_value_check.rb | 8 +- ...pregnant_household_lead_age_value_check.rb | 9 +- ...gnant_household_lead_hhmemb_value_check.rb | 9 +- ..._in_pregnant_household_lead_value_check.rb | 9 +- ...egnant_household_person_age_value_check.rb | 21 +-- ...n_pregnant_household_person_value_check.rb | 22 +-- ...range_in_pregnant_household_value_check.rb | 9 +- ...lead_tenant_over_retirement_value_check.rb | 6 +- ...ead_tenant_under_retirement_value_check.rb | 8 +- .../pages/multiple_partners_value_check.rb | 8 +- .../lettings/pages/net_income_value_check.rb | 5 +- ...pregnant_household_lead_age_value_check.rb | 9 +- ...gnant_household_lead_hhmemb_value_check.rb | 9 +- ...les_pregnant_household_lead_value_check.rb | 9 +- ...egnant_household_person_age_value_check.rb | 9 +- ...s_pregnant_household_person_value_check.rb | 9 +- ..._females_pregnant_household_value_check.rb | 9 +- .../pages/partner_under_16_value_check.rb | 8 +- .../person_over_retirement_value_check.rb | 6 +- .../person_under_retirement_value_check.rb | 8 +- .../property_major_repairs_value_check.rb | 5 +- .../lettings/pages/pscharge_value_check.rb | 8 +- .../lettings/pages/reasonother_value_check.rb | 5 +- .../lettings/pages/referral_value_check.rb | 5 +- .../form/lettings/pages/rent_value_check.rb | 5 +- .../lettings/pages/scharge_value_check.rb | 8 +- .../lettings/pages/supcharg_value_check.rb | 8 +- .../lettings/pages/void_date_value_check.rb | 5 +- .../care_home_charges_value_check.rb | 3 +- .../major_repairs_date_value_check.rb | 3 +- .../multiple_partners_value_check.rb | 3 +- .../questions/net_income_value_check.rb | 3 +- .../questions/no_retirement_value_check.rb | 3 +- .../questions/partner_under_16_value_check.rb | 3 +- .../questions/pregnancy_value_check.rb | 3 +- .../questions/pscharge_value_check.rb | 4 +- .../questions/reasonother_value_check.rb | 3 +- .../questions/referral_value_check.rb | 3 +- .../lettings/questions/rent_value_check.rb | 4 +- .../questions/retirement_value_check.rb | 3 +- .../lettings/questions/scharge_value_check.rb | 4 +- .../questions/supcharg_value_check.rb | 4 +- .../questions/void_date_value_check.rb | 3 +- config/forms/2021_2022.json | 4 +- config/forms/2022_2023.json | 4 +- config/locales/en.yml | 45 ------ .../2023/lettings/soft_validations.en.yml | 132 ++++++++++++++++++ .../2024/lettings/soft_validations.en.yml | 132 ++++++++++++++++++ .../2025/lettings/soft_validations.en.yml | 132 ++++++++++++++++++ spec/fixtures/forms/2021_2022.json | 4 +- .../interruption_screen_helper_spec.rb | 2 +- .../care_home_charges_value_check_spec.rb | 4 +- ...t_household_person_age_value_check_spec.rb | 40 ++---- ...gnant_household_person_value_check_spec.rb | 40 ++---- .../multiple_partners_value_check_spec.rb | 11 +- .../pages/net_income_value_check_spec.rb | 4 +- ...t_household_person_age_value_check_spec.rb | 40 ++---- ...gnant_household_person_value_check_spec.rb | 40 ++---- .../pages/partner_under16_value_check_spec.rb | 27 ++-- ...person_over_retirement_value_check_spec.rb | 10 +- ...erson_under_retirement_value_check_spec.rb | 8 +- .../household_characteristics_spec.rb | 2 +- .../subsections/household_needs_spec.rb | 3 +- .../subsections/household_situation_spec.rb | 2 +- .../subsections/income_and_benefits_spec.rb | 3 +- .../lettings/year2023/row_parser_spec.rb | 4 +- .../lettings/year2024/row_parser_spec.rb | 4 +- 68 files changed, 630 insertions(+), 357 deletions(-) create mode 100644 config/locales/forms/2023/lettings/soft_validations.en.yml create mode 100644 config/locales/forms/2024/lettings/soft_validations.en.yml create mode 100644 config/locales/forms/2025/lettings/soft_validations.en.yml diff --git a/app/helpers/interruption_screen_helper.rb b/app/helpers/interruption_screen_helper.rb index 7d9a38ddf..e4c09a050 100644 --- a/app/helpers/interruption_screen_helper.rb +++ b/app/helpers/interruption_screen_helper.rb @@ -1,7 +1,7 @@ module InterruptionScreenHelper def display_informative_text(informative_text, log) return informative_text if informative_text.is_a? String - return "" if informative_text.nil? + return "" if informative_text.blank? return "" unless informative_text["arguments"] translation_params = {} diff --git a/app/models/form/lettings/pages/care_home_charges_value_check.rb b/app/models/form/lettings/pages/care_home_charges_value_check.rb index 2cf253bf6..78e598e86 100644 --- a/app/models/form/lettings/pages/care_home_charges_value_check.rb +++ b/app/models/form/lettings/pages/care_home_charges_value_check.rb @@ -2,11 +2,15 @@ class Form::Lettings::Pages::CareHomeChargesValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "care_home_charges_value_check" + @copy_key = "lettings.soft_validations.care_home_charges_value_check" @depends_on = [{ "care_home_charge_expected_not_provided?" => true }] @title_text = { - "translation" => "soft_validations.care_home_charges.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + } + @informative_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } - @informative_text = "" end def questions diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb index d91794525..5b06d6a28 100644 --- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb +++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadAgeValu def initialize(id, hsh, subsection) super(id, hsh, subsection) @id = "females_in_soft_age_range_in_pregnant_household_lead_age_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check" @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb index 6fc8bdd16..3e961b283 100644 --- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb +++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadHhmembV def initialize(id, hsh, subsection) super(id, hsh, subsection) @id = "females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check" @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb index 9a2b707b3..af568b039 100644 --- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb +++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadValueCh def initialize(id, hsh, subsection) super @id = "females_in_soft_age_range_in_pregnant_household_lead_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check" @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb index 0b2e2451f..ddc8789f9 100644 --- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb +++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb @@ -2,6 +2,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonAgeVa def initialize(id, hsh, subsection, person_index:) super(id, hsh, subsection) @id = "females_in_soft_age_range_in_pregnant_household_person_#{person_index}_age_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check" @depends_on = [ { "female_in_pregnant_household_in_soft_validation_range?" => true, @@ -9,24 +10,12 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonAgeVa }, ] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } @person_index = person_index end diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb index c8d484bf4..099bea5d9 100644 --- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb +++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb @@ -2,6 +2,8 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValue def initialize(id, hsh, subsection, person_index:) super(id, hsh, subsection) @id = "females_in_soft_age_range_in_pregnant_household_person_#{person_index}_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check" + @depends_on = [ { "female_in_pregnant_household_in_soft_validation_range?" => true, @@ -9,24 +11,12 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValue }, ] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } @person_index = person_index end diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb index c816fb0b2..3822ec940 100644 --- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb +++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdValueCheck def initialize(id, hsh, subsection) super @id = "females_in_soft_age_range_in_pregnant_household_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check" @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/lead_tenant_over_retirement_value_check.rb b/app/models/form/lettings/pages/lead_tenant_over_retirement_value_check.rb index b5add868b..43b00844c 100644 --- a/app/models/form/lettings/pages/lead_tenant_over_retirement_value_check.rb +++ b/app/models/form/lettings/pages/lead_tenant_over_retirement_value_check.rb @@ -2,11 +2,13 @@ class Form::Lettings::Pages::LeadTenantOverRetirementValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @depends_on = [{ "person_1_not_retired_over_soft_max_age?" => true }] + @copy_key = "lettings.soft_validations.retirement_value_check" @title_text = { - "translation" => "soft_validations.retirement.max.title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", } @informative_text = { - "translation" => "soft_validations.retirement.max.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/lead_tenant_under_retirement_value_check.rb b/app/models/form/lettings/pages/lead_tenant_under_retirement_value_check.rb index 0c7a3ed2e..66a87c2bf 100644 --- a/app/models/form/lettings/pages/lead_tenant_under_retirement_value_check.rb +++ b/app/models/form/lettings/pages/lead_tenant_under_retirement_value_check.rb @@ -2,8 +2,9 @@ class Form::Lettings::Pages::LeadTenantUnderRetirementValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @depends_on = [{ "person_1_retired_under_soft_min_age?" => true }] + @copy_key = "lettings.soft_validations.no_retirement_value_check" @title_text = { - "translation" => "soft_validations.retirement.min.title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "age1", @@ -12,7 +13,10 @@ class Form::Lettings::Pages::LeadTenantUnderRetirementValueCheck < ::Form::Page }, ], } - @informative_text = {} + @informative_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], + } end def questions diff --git a/app/models/form/lettings/pages/multiple_partners_value_check.rb b/app/models/form/lettings/pages/multiple_partners_value_check.rb index 3f9cdb3ae..4e9167a12 100644 --- a/app/models/form/lettings/pages/multiple_partners_value_check.rb +++ b/app/models/form/lettings/pages/multiple_partners_value_check.rb @@ -6,12 +6,16 @@ class Form::Lettings::Pages::MultiplePartnersValueCheck < Form::Page "multiple_partners?" => true, }, ] + @copy_key = "lettings.soft_validations.multiple_partners_value_check" @person_index = person_index @title_text = { - "translation" => "soft_validations.multiple_partners_lettings.title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], + } + @informative_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } - @informative_text = {} end def questions diff --git a/app/models/form/lettings/pages/net_income_value_check.rb b/app/models/form/lettings/pages/net_income_value_check.rb index ccb2b2a08..9bdce131d 100644 --- a/app/models/form/lettings/pages/net_income_value_check.rb +++ b/app/models/form/lettings/pages/net_income_value_check.rb @@ -2,9 +2,10 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "net_income_value_check" + @copy_key = "lettings.soft_validations.net_income_value_check" @depends_on = [{ "net_income_soft_validation_triggered?" => true }] @title_text = { - "translation" => "soft_validations.net_income.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "incfreq", @@ -20,7 +21,7 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page } @informative_text = { - "translation" => "soft_validations.net_income.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [ { "key" => "net_income_higher_or_lower_text", diff --git a/app/models/form/lettings/pages/no_females_pregnant_household_lead_age_value_check.rb b/app/models/form/lettings/pages/no_females_pregnant_household_lead_age_value_check.rb index 68b1c7f09..7e530a9ad 100644 --- a/app/models/form/lettings/pages/no_females_pregnant_household_lead_age_value_check.rb +++ b/app/models/form/lettings/pages/no_females_pregnant_household_lead_age_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadAgeValueCheck < ::For def initialize(id, hsh, subsection) super(id, hsh, subsection) @id = "no_females_pregnant_household_lead_age_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check" @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/no_females_pregnant_household_lead_hhmemb_value_check.rb b/app/models/form/lettings/pages/no_females_pregnant_household_lead_hhmemb_value_check.rb index e1d1235ef..47ac7493b 100644 --- a/app/models/form/lettings/pages/no_females_pregnant_household_lead_hhmemb_value_check.rb +++ b/app/models/form/lettings/pages/no_females_pregnant_household_lead_hhmemb_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadHhmembValueCheck < :: def initialize(id, hsh, subsection) super @id = "no_females_pregnant_household_lead_hhmemb_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check" @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/no_females_pregnant_household_lead_value_check.rb b/app/models/form/lettings/pages/no_females_pregnant_household_lead_value_check.rb index 416845735..edfe2c631 100644 --- a/app/models/form/lettings/pages/no_females_pregnant_household_lead_value_check.rb +++ b/app/models/form/lettings/pages/no_females_pregnant_household_lead_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadValueCheck < ::Form:: def initialize(id, hsh, subsection) super @id = "no_females_pregnant_household_lead_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check" @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check.rb b/app/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check.rb index 12db3a08e..5e808b853 100644 --- a/app/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check.rb +++ b/app/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck < ::F def initialize(id, hsh, subsection, person_index:) super(id, hsh, subsection) @id = "no_females_pregnant_household_person_#{person_index}_age_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check" @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true, "age#{person_index}_known" => 0 }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } @person_index = person_index end diff --git a/app/models/form/lettings/pages/no_females_pregnant_household_person_value_check.rb b/app/models/form/lettings/pages/no_females_pregnant_household_person_value_check.rb index f04333ec0..fb77eec18 100644 --- a/app/models/form/lettings/pages/no_females_pregnant_household_person_value_check.rb +++ b/app/models/form/lettings/pages/no_females_pregnant_household_person_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck < ::Form def initialize(id, hsh, subsection, person_index:) super(id, hsh, subsection) @id = "no_females_pregnant_household_person_#{person_index}_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check" @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true, "details_known_#{person_index}" => 0 }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } @person_index = person_index end diff --git a/app/models/form/lettings/pages/no_females_pregnant_household_value_check.rb b/app/models/form/lettings/pages/no_females_pregnant_household_value_check.rb index 9c84a953f..bce8a87ae 100644 --- a/app/models/form/lettings/pages/no_females_pregnant_household_value_check.rb +++ b/app/models/form/lettings/pages/no_females_pregnant_household_value_check.rb @@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "no_females_pregnant_household_value_check" + @copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check" @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @title_text = { - "translation" => "soft_validations.pregnancy.title", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", + "arguments" => [], } @informative_text = { - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } end diff --git a/app/models/form/lettings/pages/partner_under_16_value_check.rb b/app/models/form/lettings/pages/partner_under_16_value_check.rb index 87d5865c4..b33a827d4 100644 --- a/app/models/form/lettings/pages/partner_under_16_value_check.rb +++ b/app/models/form/lettings/pages/partner_under_16_value_check.rb @@ -6,9 +6,10 @@ class Form::Lettings::Pages::PartnerUnder16ValueCheck < Form::Page "person_#{person_index}_partner_under_16?" => true, }, ] + @copy_key = "lettings.soft_validations.partner_under_16_value_check" @person_index = person_index @title_text = { - "translation" => "soft_validations.partner_under_16_lettings.title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "age#{person_index}", @@ -17,7 +18,10 @@ class Form::Lettings::Pages::PartnerUnder16ValueCheck < Form::Page }, ], } - @informative_text = {} + @informative_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], + } end def questions diff --git a/app/models/form/lettings/pages/person_over_retirement_value_check.rb b/app/models/form/lettings/pages/person_over_retirement_value_check.rb index dbaf2d2e2..c094d4a93 100644 --- a/app/models/form/lettings/pages/person_over_retirement_value_check.rb +++ b/app/models/form/lettings/pages/person_over_retirement_value_check.rb @@ -2,11 +2,13 @@ class Form::Lettings::Pages::PersonOverRetirementValueCheck < ::Form::Page def initialize(id, hsh, subsection, person_index:) super(id, hsh, subsection) @depends_on = [{ "person_#{person_index}_not_retired_over_soft_max_age?" => true }] + @copy_key = "lettings.soft_validations.retirement_value_check" @title_text = { - "translation" => "soft_validations.retirement.max.title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", } @informative_text = { - "translation" => "soft_validations.retirement.max.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], } @person_index = person_index end diff --git a/app/models/form/lettings/pages/person_under_retirement_value_check.rb b/app/models/form/lettings/pages/person_under_retirement_value_check.rb index ab9c81beb..853afafe0 100644 --- a/app/models/form/lettings/pages/person_under_retirement_value_check.rb +++ b/app/models/form/lettings/pages/person_under_retirement_value_check.rb @@ -2,8 +2,9 @@ class Form::Lettings::Pages::PersonUnderRetirementValueCheck < ::Form::Page def initialize(id, hsh, subsection, person_index:) super(id, hsh, subsection) @depends_on = [{ "person_#{person_index}_retired_under_soft_min_age?" => true }] + @copy_key = "lettings.soft_validations.no_retirement_value_check" @title_text = { - "translation" => "soft_validations.retirement.min.title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "age#{person_index}", @@ -12,7 +13,10 @@ class Form::Lettings::Pages::PersonUnderRetirementValueCheck < ::Form::Page }, ], } - @informative_text = {} + @informative_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], + } @person_index = person_index end diff --git a/app/models/form/lettings/pages/property_major_repairs_value_check.rb b/app/models/form/lettings/pages/property_major_repairs_value_check.rb index 08672aff6..d1c7be34c 100644 --- a/app/models/form/lettings/pages/property_major_repairs_value_check.rb +++ b/app/models/form/lettings/pages/property_major_repairs_value_check.rb @@ -2,10 +2,11 @@ class Form::Lettings::Pages::PropertyMajorRepairsValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "property_major_repairs_value_check" + @copy_key = "lettings.soft_validations.major_repairs_date_value_check" @depends_on = [{ "major_repairs_date_in_soft_range?" => true }] - @title_text = { "translation" => "soft_validations.major_repairs_date.title_text" } + @title_text = { "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text" } @informative_text = { - "translation" => "soft_validations.major_repairs_date.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/lettings/pages/pscharge_value_check.rb b/app/models/form/lettings/pages/pscharge_value_check.rb index 6c8ada196..8ff953afd 100644 --- a/app/models/form/lettings/pages/pscharge_value_check.rb +++ b/app/models/form/lettings/pages/pscharge_value_check.rb @@ -2,16 +2,20 @@ class Form::Lettings::Pages::PschargeValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "pscharge_value_check" + @copy_key = "lettings.soft_validations.pscharge_value_check" @depends_on = [{ "pscharge_in_soft_max_range?" => true }] @title_text = { - "translation" => "soft_validations.pscharge.over_soft_max_title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [{ "key" => "pscharge", "label" => true, "i18n_template" => "pscharge", }], } - @informative_text = I18n.t("soft_validations.charges.informative_text") + @informative_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], + } end def questions diff --git a/app/models/form/lettings/pages/reasonother_value_check.rb b/app/models/form/lettings/pages/reasonother_value_check.rb index ccda997a7..ccc6be70d 100644 --- a/app/models/form/lettings/pages/reasonother_value_check.rb +++ b/app/models/form/lettings/pages/reasonother_value_check.rb @@ -2,13 +2,14 @@ class Form::Lettings::Pages::ReasonotherValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "reasonother_value_check" + @copy_key = "lettings.soft_validations.reasonother_value_check" @depends_on = [{ "reasonother_might_be_existing_category?" => true }] @title_text = { - "translation" => "soft_validations.reasonother.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [{ "key" => "reasonother", "i18n_template" => "reasonother" }], } @informative_text = { - "translation" => "soft_validations.reasonother.informative_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/lettings/pages/referral_value_check.rb b/app/models/form/lettings/pages/referral_value_check.rb index 55f6f3e8b..aa3a34200 100644 --- a/app/models/form/lettings/pages/referral_value_check.rb +++ b/app/models/form/lettings/pages/referral_value_check.rb @@ -2,12 +2,13 @@ class Form::Lettings::Pages::ReferralValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "referral_value_check" + @copy_key = "lettings.soft_validations.referral_value_check" @depends_on = [{ "la_referral_for_general_needs?" => true }] @title_text = { - "translation" => "soft_validations.referral.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", } @informative_text = { - "translation" => "soft_validations.referral.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/lettings/pages/rent_value_check.rb b/app/models/form/lettings/pages/rent_value_check.rb index a80dc7339..5a1ecc847 100644 --- a/app/models/form/lettings/pages/rent_value_check.rb +++ b/app/models/form/lettings/pages/rent_value_check.rb @@ -2,8 +2,9 @@ class Form::Lettings::Pages::RentValueCheck < ::Form::Page def initialize(id, hsh, subsection, check_answers_card_number: nil) super(id, hsh, subsection) @depends_on = [{ "rent_soft_validation_triggered?" => true }] + @copy_key = "lettings.soft_validations.rent_value_check" @title_text = { - "translation" => "soft_validations.rent.outside_range_title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "brent", @@ -13,7 +14,7 @@ class Form::Lettings::Pages::RentValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.rent.informative_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [ { "key" => "rent_soft_validation_higher_or_lower_text", diff --git a/app/models/form/lettings/pages/scharge_value_check.rb b/app/models/form/lettings/pages/scharge_value_check.rb index 73ee41920..bd9accfc1 100644 --- a/app/models/form/lettings/pages/scharge_value_check.rb +++ b/app/models/form/lettings/pages/scharge_value_check.rb @@ -2,16 +2,20 @@ class Form::Lettings::Pages::SchargeValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "scharge_value_check" + @copy_key = "lettings.soft_validations.scharge_value_check" @depends_on = [{ "scharge_in_soft_max_range?" => true }] @title_text = { - "translation" => "soft_validations.scharge.over_soft_max_title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [{ "key" => "scharge", "label" => true, "i18n_template" => "scharge", }], } - @informative_text = I18n.t("soft_validations.charges.informative_text") + @title_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], + } end def questions diff --git a/app/models/form/lettings/pages/supcharg_value_check.rb b/app/models/form/lettings/pages/supcharg_value_check.rb index a974a8f89..89dcc89c1 100644 --- a/app/models/form/lettings/pages/supcharg_value_check.rb +++ b/app/models/form/lettings/pages/supcharg_value_check.rb @@ -2,16 +2,20 @@ class Form::Lettings::Pages::SupchargValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "supcharg_value_check" + @copy_key = "lettings.soft_validations.supcharg_value_check" @depends_on = [{ "supcharg_in_soft_max_range?" => true }] @title_text = { - "translation" => "soft_validations.supcharg.over_soft_max_title", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [{ "key" => "supcharg", "label" => true, "i18n_template" => "supcharg", }], } - @informative_text = I18n.t("soft_validations.charges.informative_text") + @informative_text = { + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", + "arguments" => [], + } end def questions diff --git a/app/models/form/lettings/pages/void_date_value_check.rb b/app/models/form/lettings/pages/void_date_value_check.rb index 6ebd3a175..b5d7fdadd 100644 --- a/app/models/form/lettings/pages/void_date_value_check.rb +++ b/app/models/form/lettings/pages/void_date_value_check.rb @@ -2,10 +2,11 @@ class Form::Lettings::Pages::VoidDateValueCheck < ::Form::Page def initialize(id, hsh, subsection) super @id = "void_date_value_check" + @copy_key = "lettings.soft_validations.void_date_value_check" @depends_on = [{ "voiddate_in_soft_range?" => true }] - @title_text = { "translation" => "soft_validations.void_date.title_text" } + @title_text = { "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text" } @informative_text = { - "translation" => "soft_validations.void_date.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/lettings/questions/care_home_charges_value_check.rb b/app/models/form/lettings/questions/care_home_charges_value_check.rb index fdb5aabbd..a5f0d2522 100644 --- a/app/models/form/lettings/questions/care_home_charges_value_check.rb +++ b/app/models/form/lettings/questions/care_home_charges_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::CareHomeChargesValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "carehome_charges_value_check" - @check_answer_label = "Care home charges confirmation" - @header = "Are you sure there are no care home charges?" + @copy_key = "lettings.soft_validations.care_home_charges_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/major_repairs_date_value_check.rb b/app/models/form/lettings/questions/major_repairs_date_value_check.rb index d024f1a8d..0e9cb4171 100644 --- a/app/models/form/lettings/questions/major_repairs_date_value_check.rb +++ b/app/models/form/lettings/questions/major_repairs_date_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::MajorRepairsDateValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "major_repairs_date_value_check" - @check_answer_label = "Major repairs date confirmation" - @header = "Are you sure the property has been vacant for this long?" + @copy_key = "lettings.soft_validations.major_repairs_date_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/multiple_partners_value_check.rb b/app/models/form/lettings/questions/multiple_partners_value_check.rb index 65320ffdf..9dd9f7015 100644 --- a/app/models/form/lettings/questions/multiple_partners_value_check.rb +++ b/app/models/form/lettings/questions/multiple_partners_value_check.rb @@ -2,7 +2,7 @@ class Form::Lettings::Questions::MultiplePartnersValueCheck < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @id = "multiple_partners_value_check" - @check_answer_label = "Multiple partners confirmation" + @copy_key = "lettings.soft_validations.multiple_partners_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, @@ -19,6 +19,5 @@ class Form::Lettings::Questions::MultiplePartnersValueCheck < ::Form::Question ], } @check_answers_card_number = person_index - @header = "Are you sure this is correct?" end end diff --git a/app/models/form/lettings/questions/net_income_value_check.rb b/app/models/form/lettings/questions/net_income_value_check.rb index 8267b3b22..4e85fee90 100644 --- a/app/models/form/lettings/questions/net_income_value_check.rb +++ b/app/models/form/lettings/questions/net_income_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::NetIncomeValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "net_income_value_check" - @check_answer_label = "Net income confirmation" - @header = "Are you sure this is correct?" + @copy_key = "lettings.soft_validations.net_income_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/no_retirement_value_check.rb b/app/models/form/lettings/questions/no_retirement_value_check.rb index 0e2033c61..82784dec8 100644 --- a/app/models/form/lettings/questions/no_retirement_value_check.rb +++ b/app/models/form/lettings/questions/no_retirement_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::NoRetirementValueCheck < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @id = "retirement_value_check" - @check_answer_label = "Retirement confirmation" - @header = "Are you sure this person is retired?" + @copy_key = "lettings.soft_validations.no_retirement_value_check" @type = "interruption_screen" @check_answers_card_number = person_index @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/partner_under_16_value_check.rb b/app/models/form/lettings/questions/partner_under_16_value_check.rb index 7cda45cb5..bc11aec47 100644 --- a/app/models/form/lettings/questions/partner_under_16_value_check.rb +++ b/app/models/form/lettings/questions/partner_under_16_value_check.rb @@ -2,7 +2,7 @@ class Form::Lettings::Questions::PartnerUnder16ValueCheck < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @id = "partner_under_16_value_check" - @check_answer_label = "Partner under 16 confirmation" + @copy_key = "lettings.soft_validations.partner_under_16_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, @@ -19,6 +19,5 @@ class Form::Lettings::Questions::PartnerUnder16ValueCheck < ::Form::Question ], } @check_answers_card_number = person_index - @header = "Are you sure this is correct?" end end diff --git a/app/models/form/lettings/questions/pregnancy_value_check.rb b/app/models/form/lettings/questions/pregnancy_value_check.rb index 9ef1778c2..0ddddecec 100644 --- a/app/models/form/lettings/questions/pregnancy_value_check.rb +++ b/app/models/form/lettings/questions/pregnancy_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::PregnancyValueCheck < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @id = "pregnancy_value_check" - @check_answer_label = "Pregnancy confirmation" - @header = "Are you sure this is correct?" + @copy_key = page.copy_key @type = "interruption_screen" @check_answers_card_number = person_index @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/pscharge_value_check.rb b/app/models/form/lettings/questions/pscharge_value_check.rb index b44979ae1..efb94fb53 100644 --- a/app/models/form/lettings/questions/pscharge_value_check.rb +++ b/app/models/form/lettings/questions/pscharge_value_check.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::PschargeValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "pscharge_value_check" - @check_answer_label = "Personal service charge confirmation" - @header = "Are you sure?" + @copy_key = "lettings.soft_validations.pscharge_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS @hidden_in_check_answers = { "depends_on" => [{ "pscharge_value_check" => 0 }, { "pscharge_value_check" => 1 }] } - @hint_text = I18n.t("soft_validations.charges.hint_text") end ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze diff --git a/app/models/form/lettings/questions/reasonother_value_check.rb b/app/models/form/lettings/questions/reasonother_value_check.rb index 865f38764..9fb5618fc 100644 --- a/app/models/form/lettings/questions/reasonother_value_check.rb +++ b/app/models/form/lettings/questions/reasonother_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::ReasonotherValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "reasonother_value_check" - @check_answer_label = "Reason other confirmation" - @header = "Are you sure this doesn’t fit an existing category?" + @copy_key = "lettings.soft_validations.reasonother_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/referral_value_check.rb b/app/models/form/lettings/questions/referral_value_check.rb index 30aa45f4c..04dfadd9e 100644 --- a/app/models/form/lettings/questions/referral_value_check.rb +++ b/app/models/form/lettings/questions/referral_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::ReferralValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "referral_value_check" - @check_answer_label = "Referral confirmation" - @header = "Are you sure?" + @copy_key = "lettings.soft_validations.referral_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/rent_value_check.rb b/app/models/form/lettings/questions/rent_value_check.rb index 688499259..fb7ac8d16 100644 --- a/app/models/form/lettings/questions/rent_value_check.rb +++ b/app/models/form/lettings/questions/rent_value_check.rb @@ -2,10 +2,8 @@ class Form::Lettings::Questions::RentValueCheck < ::Form::Question def initialize(id, hsh, page, check_answers_card_number:) super(id, hsh, page) @id = "rent_value_check" - @check_answer_label = "Total rent confirmation" - @header = "Are you sure this is correct?" + @copy_key = "lettings.soft_validations.rent_value_check" @type = "interruption_screen" - @hint_text = I18n.t("soft_validations.rent.hint_text") @check_answers_card_number = check_answers_card_number @answer_options = ANSWER_OPTIONS @hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] } diff --git a/app/models/form/lettings/questions/retirement_value_check.rb b/app/models/form/lettings/questions/retirement_value_check.rb index 63a286d61..23d077fbf 100644 --- a/app/models/form/lettings/questions/retirement_value_check.rb +++ b/app/models/form/lettings/questions/retirement_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::RetirementValueCheck < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @id = "retirement_value_check" - @check_answer_label = "Retirement confirmation" - @header = "Are you sure this person isn’t retired?" + @copy_key = "lettings.soft_validations.retirement_value_check" @type = "interruption_screen" @check_answers_card_number = person_index @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/lettings/questions/scharge_value_check.rb b/app/models/form/lettings/questions/scharge_value_check.rb index 1946d603f..0f761b7aa 100644 --- a/app/models/form/lettings/questions/scharge_value_check.rb +++ b/app/models/form/lettings/questions/scharge_value_check.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SchargeValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "scharge_value_check" - @check_answer_label = "Service charge confirmation" - @header = "Are you sure?" + @copy_key = "lettings.soft_validations.scharge_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS @hidden_in_check_answers = { "depends_on" => [{ "scharge_value_check" => 0 }, { "scharge_value_check" => 1 }] } - @hint_text = I18n.t("soft_validations.charges.hint_text") end ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze diff --git a/app/models/form/lettings/questions/supcharg_value_check.rb b/app/models/form/lettings/questions/supcharg_value_check.rb index 978c5e3ef..10fd6562c 100644 --- a/app/models/form/lettings/questions/supcharg_value_check.rb +++ b/app/models/form/lettings/questions/supcharg_value_check.rb @@ -2,13 +2,11 @@ class Form::Lettings::Questions::SupchargValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "supcharg_value_check" - @check_answer_label = "Support charge confirmation" - @header = "Are you sure?" + @copy_key = "lettings.soft_validations.supcharg_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS @hidden_in_check_answers = { "depends_on" => [{ "supcharg_value_check" => 0 }, { "supcharg_value_check" => 1 }] } - @hint_text = I18n.t("soft_validations.charges.hint_text") end ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze diff --git a/app/models/form/lettings/questions/void_date_value_check.rb b/app/models/form/lettings/questions/void_date_value_check.rb index 22446061f..faf507a1b 100644 --- a/app/models/form/lettings/questions/void_date_value_check.rb +++ b/app/models/form/lettings/questions/void_date_value_check.rb @@ -2,8 +2,7 @@ class Form::Lettings::Questions::VoidDateValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "void_date_value_check" - @check_answer_label = "Void date confirmation" - @header = "Are you sure the property has been vacant for this long?" + @copy_key = "lettings.soft_validations.void_date_value_check" @type = "interruption_screen" @check_answers_card_number = 0 @answer_options = ANSWER_OPTIONS diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 6ebc090b6..ac615b0e2 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -7411,10 +7411,10 @@ } ], "title_text": { - "translation": "soft_validations.net_income.title_text" + "translation": "forms.2024.lettings.soft_validations.net_income_value_check.title_text" }, "informative_text": { - "translation": "soft_validations.net_income.hint_text", + "translation": "forms.2024.lettings.soft_validations.net_income_value_check.informative_text", "arguments": [ { "key": "ecstat1", diff --git a/config/forms/2022_2023.json b/config/forms/2022_2023.json index 54cd67fd4..7d6f44b20 100644 --- a/config/forms/2022_2023.json +++ b/config/forms/2022_2023.json @@ -7870,7 +7870,7 @@ } ], "title_text": { - "translation": "soft_validations.net_income.title_text", + "translation": "forms.2024.lettings.soft_validations.net_income_value_check.title_text", "arguments": [ { "key": "incfreq", @@ -7885,7 +7885,7 @@ ] }, "informative_text": { - "translation": "soft_validations.net_income.hint_text", + "translation": "forms.2024.lettings.soft_validations.net_income_value_check.informative_text", "arguments": [ { "key": "net_income_higher_or_lower_text", diff --git a/config/locales/en.yml b/config/locales/en.yml index 81c94b8c4..55044b7a6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -553,17 +553,6 @@ en: organisation_not_selected: "Select an organisation from the search list." soft_validations: - net_income: - title_text: "You told us that the household’s income is %{earnings} %{incfreq}." - hint_text: "This is %{net_income_higher_or_lower_text} than we would expect for the household’s working situation." - in_soft_min_range: - message: "Net income is lower than expected based on the household’s working situation. Are you sure this is correct?" - in_soft_max_range: - message: "Net income is higher than expected based on the household’s working situation. Are you sure this is correct?" - rent: - outside_range_title: "You told us the rent is %{brent}." - informative_text: "This is %{higher_or_lower} than we would expect." - hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the rent type is correct, for example affordable or social rent
" retirement: min: title: "You told us this person is aged %{age} years and retired." @@ -571,40 +560,6 @@ en: max: title: "You told us this person is over 66 and not retired." hint_text: "The minimum expected retirement age in England is 66." - pregnancy: - title: "You told us somebody in the household is pregnant." - all_male_tenants: "You also told us that all the tenants living at the property are male." - females_not_in_soft_age_range: "You also told us that any female tenants living at the property are in the following age ranges:
  • under 16 years old
  • over 50 years old
" - major_repairs_date: - title_text: "You told us the property has been vacant for 2 years." - hint_text: "This is higher than we would expect." - void_date: - title_text: "You told us that the property has been vacant for more than 2 years." - hint_text: "This is higher than we would expect." - referral: - title_text: "Are you sure?" - hint_text: "This is a general needs log, and this referral type is for supported housing." - scharge: - over_soft_max_title: "You told us the service charge is %{scharge}." - pscharge: - over_soft_max_title: "You told us the personal service charge is %{pscharge}." - supcharg: - over_soft_max_title: "You told us the support charge is %{supcharg}." - charges: - informative_text: "This is higher than we would expect." - hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" - reasonother: - title_text: "You told us that the tenant’s main reason for leaving their last settled home was %{reasonother}." - informative_text: "The reason you have entered looks very similar to one of the existing response categories. - Please check the categories and select the appropriate one. - If the existing categories are not suitable, please confirm here to move onto the next question." - saledate: - must_be_less_than_3_years_from_hodate: "You told us sale completion date is more than 3 years after practical completion or handover date." - partner_under_16_lettings: - title: "You told us this person is aged %{age} years and has 'Partner' relationship to the lead tenant." - multiple_partners_lettings: - title: "You told us there are more than 1 persons with 'Partner' relationship to the lead tenant." - devise: two_factor_authentication: success: "Two-factor authentication successful." diff --git a/config/locales/forms/2023/lettings/soft_validations.en.yml b/config/locales/forms/2023/lettings/soft_validations.en.yml new file mode 100644 index 000000000..d0354f127 --- /dev/null +++ b/config/locales/forms/2023/lettings/soft_validations.en.yml @@ -0,0 +1,132 @@ +en: + forms: + 2023: + lettings: + soft_validations: + pregnancy_value_check: + no_females_pregnant_household_value_check: + page_header: "" + check_answer_label: "Pregnancy confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us somebody in the household is pregnant." + informative_text: "You also told us that all the tenants living at the property are male." + females_in_soft_age_range_in_pregnant_household_value_check: + page_header: "" + check_answer_label: "Pregnancy confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us somebody in the household is pregnant." + informative_text: "You also told us that any female tenants living at the property are in the following age ranges:
  • under 16 years old
  • over 50 years old
" + + no_retirement_value_check: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person is retired?" + title_text: "You told us this person is aged %{age} years and retired." + informative_text: "The minimum expected retirement age in England is 66." + + retirement_value_check: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person isn’t retired?" + title_text: "You told us this person is over 66 and not retired." + informative_text: "" + + partner_under_16_value_check: + page_header: "" + check_answer_label: "Partner under 16 confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to the lead tenant." + informative_text: "Are you sure this is correct?" + + multiple_partners_value_check: + page_header: "" + check_answer_label: "Multiple partners confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us there are more than 1 persons with 'Partner' relationship to the lead tenant." + informative_text: "Are you sure this is correct?" + + reasonother_value_check: + page_header: "" + check_answer_label: "Reason other confirmation" + hint_text: "" + question_text: "Are you sure this doesn’t fit an existing category?" + title_text: "You told us that the tenant’s main reason for leaving their last settled home was %{reasonother}." + informative_text: "The reason you have entered looks very similar to one of the existing response categories. Please check the categories and select the appropriate one. If the existing categories are not suitable, please confirm here to move onto the next question." + + referral_value_check: + page_header: "" + check_answer_label: "Referral confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "Are you sure?" + informative_text: "This is a general needs log, and this referral type is for supported housing." + + net_income_value_check: + page_header: "" + check_answer_label: "Net income confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the household’s income is %{earnings} %{incfreq}." + informative_text: "This is %{net_income_higher_or_lower_text} than we would expect for the household’s working situation." + + care_home_charges_value_check: + page_header: "" + check_answer_label: "Care home charges confirmation" + hint_text: "" + question_text: "Are you sure there are no care home charges?" + title_text: "Care home charges should be provided if this is a care home accommodation." + informative_text: "Are you sure there are no care home charges?" + + rent_value_check: + page_header: "" + check_answer_label: "Total rent confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the rent type is correct, for example affordable or social rent
" + question_text: "Are you sure this is correct?" + title_text: "You told us the rent is %{brent}." + informative_text: "This is %{higher_or_lower} than we would expect." + + scharge_value_check: + page_header: "" + check_answer_label: "Service charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the service charge is %{scharge}." + informative_text: "This is higher than we would expect." + + pscharge_value_check: + page_header: "" + check_answer_label: "Personal service charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the personal service charge is %{pscharge}." + informative_text: "This is higher than we would expect." + + supcharg_value_check: + page_header: "" + check_answer_label: "Support charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the support charge is %{supcharg}." + informative_text: "This is higher than we would expect." + + void_date_value_check: + page_header: "" + check_answer_label: "Void date confirmation" + hint_text: "" + question_text: "Are you sure the property has been vacant for this long?" + title_text: "You told us that the property has been vacant for more than 2 years." + informative_text: "This is higher than we would expect." + + major_repairs_date_value_check: + page_header: "" + check_answer_label: "Major repairs date confirmation" + hint_text: "" + question_text: "Are you sure the property has been vacant for this long?" + title_text: "You told us the property has been vacant for 2 years." + informative_text: "This is higher than we would expect." diff --git a/config/locales/forms/2024/lettings/soft_validations.en.yml b/config/locales/forms/2024/lettings/soft_validations.en.yml new file mode 100644 index 000000000..ada093d39 --- /dev/null +++ b/config/locales/forms/2024/lettings/soft_validations.en.yml @@ -0,0 +1,132 @@ +en: + forms: + 2024: + lettings: + soft_validations: + pregnancy_value_check: + no_females_pregnant_household_value_check: + page_header: "" + check_answer_label: "Pregnancy confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us somebody in the household is pregnant." + informative_text: "You also told us that all the tenants living at the property are male." + females_in_soft_age_range_in_pregnant_household_value_check: + page_header: "" + check_answer_label: "Pregnancy confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us somebody in the household is pregnant." + informative_text: "You also told us that any female tenants living at the property are in the following age ranges:
  • under 16 years old
  • over 50 years old
" + + no_retirement_value_check: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person is retired?" + title_text: "You told us this person is aged %{age} years and retired." + informative_text: "The minimum expected retirement age in England is 66." + + retirement_value_check: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person isn’t retired?" + title_text: "You told us this person is over 66 and not retired." + informative_text: "Are you sure this person isn’t retired?" + + partner_under_16_value_check: + page_header: "" + check_answer_label: "Partner under 16 confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to the lead tenant." + informative_text: "Are you sure this is correct?" + + multiple_partners_value_check: + page_header: "" + check_answer_label: "Multiple partners confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us there are more than 1 persons with 'Partner' relationship to the lead tenant." + informative_text: "Are you sure this is correct?" + + reasonother_value_check: + page_header: "" + check_answer_label: "Reason other confirmation" + hint_text: "" + question_text: "Are you sure this doesn’t fit an existing category?" + title_text: "You told us that the tenant’s main reason for leaving their last settled home was %{reasonother}." + informative_text: "The reason you have entered looks very similar to one of the existing response categories. Please check the categories and select the appropriate one. If the existing categories are not suitable, please confirm here to move onto the next question." + + referral_value_check: + page_header: "" + check_answer_label: "Referral confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "Are you sure?" + informative_text: "This is a general needs log, and this referral type is for supported housing." + + net_income_value_check: + page_header: "" + check_answer_label: "Net income confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the household’s income is %{earnings} %{incfreq}." + informative_text: "This is %{net_income_higher_or_lower_text} than we would expect for the household’s working situation." + + care_home_charges_value_check: + page_header: "" + check_answer_label: "Care home charges confirmation" + hint_text: "" + question_text: "Are you sure there are no care home charges?" + title_text: "Care home charges should be provided if this is a care home accommodation." + informative_text: "Are you sure there are no care home charges?" + + rent_value_check: + page_header: "" + check_answer_label: "Total rent confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the rent type is correct, for example affordable or social rent
" + question_text: "Are you sure this is correct?" + title_text: "You told us the rent is %{brent}." + informative_text: "This is %{higher_or_lower} than we would expect." + + scharge_value_check: + page_header: "" + check_answer_label: "Service charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the service charge is %{scharge}." + informative_text: "This is higher than we would expect." + + pscharge_value_check: + page_header: "" + check_answer_label: "Personal service charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the personal service charge is %{pscharge}." + informative_text: "This is higher than we would expect." + + supcharg_value_check: + page_header: "" + check_answer_label: "Support charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the support charge is %{supcharg}." + informative_text: "This is higher than we would expect." + + void_date_value_check: + page_header: "" + check_answer_label: "Void date confirmation" + hint_text: "" + question_text: "Are you sure the property has been vacant for this long?" + title_text: "You told us that the property has been vacant for more than 2 years." + informative_text: "This is longer than we would expect." + + major_repairs_date_value_check: + page_header: "" + check_answer_label: "Major repairs date confirmation" + hint_text: "" + question_text: "Are you sure the property has been vacant for this long?" + title_text: "You told us the property has been vacant for 2 years." + informative_text: "This is longer than we would expect." diff --git a/config/locales/forms/2025/lettings/soft_validations.en.yml b/config/locales/forms/2025/lettings/soft_validations.en.yml new file mode 100644 index 000000000..03a3cbb3d --- /dev/null +++ b/config/locales/forms/2025/lettings/soft_validations.en.yml @@ -0,0 +1,132 @@ +en: + forms: + 2025: + lettings: + soft_validations: + pregnancy_value_check: + no_females_pregnant_household_value_check: + page_header: "" + check_answer_label: "Pregnancy confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us somebody in the household is pregnant." + informative_text: "You also told us that all the tenants living at the property are male." + females_in_soft_age_range_in_pregnant_household_value_check: + page_header: "" + check_answer_label: "Pregnancy confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us somebody in the household is pregnant." + informative_text: "You also told us that any female tenants living at the property are in the following age ranges:
  • under 16 years old
  • over 50 years old
" + + no_retirement_value_check: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person is retired?" + title_text: "You told us this person is aged %{age} years and retired." + informative_text: "The minimum expected retirement age in England is 66." + + retirement_value_check: + page_header: "" + check_answer_label: "Retirement confirmation" + hint_text: "" + question_text: "Are you sure this person isn’t retired?" + title_text: "You told us this person is over 66 and not retired." + informative_text: "Are you sure this person isn’t retired?" + + partner_under_16_value_check: + page_header: "" + check_answer_label: "Partner under 16 confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to the lead tenant." + informative_text: "Are you sure this is correct?" + + multiple_partners_value_check: + page_header: "" + check_answer_label: "Multiple partners confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us there are more than 1 persons with 'Partner' relationship to the lead tenant." + informative_text: "Are you sure this is correct?" + + reasonother_value_check: + page_header: "" + check_answer_label: "Reason other confirmation" + hint_text: "" + question_text: "Are you sure this doesn’t fit an existing category?" + title_text: "You told us that the tenant’s main reason for leaving their last settled home was %{reasonother}." + informative_text: "The reason you have entered looks very similar to one of the existing response categories. Please check the categories and select the appropriate one. If the existing categories are not suitable, please confirm here to move onto the next question." + + referral_value_check: + page_header: "" + check_answer_label: "Referral confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "Are you sure?" + informative_text: "This is a general needs log, and this referral type is for supported housing." + + net_income_value_check: + page_header: "" + check_answer_label: "Net income confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the household’s income is %{earnings} %{incfreq}." + informative_text: "This is %{net_income_higher_or_lower_text} than we would expect for the household’s working situation." + + care_home_charges_value_check: + page_header: "" + check_answer_label: "Care home charges confirmation" + hint_text: "" + question_text: "Are you sure there are no care home charges?" + title_text: "Care home charges should be provided if this is a care home accommodation." + informative_text: "Are you sure there are no care home charges?" + + rent_value_check: + page_header: "" + check_answer_label: "Total rent confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the rent type is correct, for example affordable or social rent
" + question_text: "Are you sure this is correct?" + title_text: "You told us the rent is %{brent}." + informative_text: "This is %{higher_or_lower} than we would expect." + + scharge_value_check: + page_header: "" + check_answer_label: "Service charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the service charge is %{scharge}." + informative_text: "This is higher than we would expect." + + pscharge_value_check: + page_header: "" + check_answer_label: "Personal service charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the personal service charge is %{pscharge}." + informative_text: "This is higher than we would expect." + + supcharg_value_check: + page_header: "" + check_answer_label: "Support charge confirmation" + hint_text: "Check the following:
  • the decimal point
  • the frequency, for example every week or every calendar month
  • the needs type
" + question_text: "Are you sure?" + title_text: "You told us the support charge is %{supcharg}." + informative_text: "This is higher than we would expect." + + void_date_value_check: + page_header: "" + check_answer_label: "Void date confirmation" + hint_text: "" + question_text: "Are you sure the property has been vacant for this long?" + title_text: "You told us that the property has been vacant for more than 2 years." + informative_text: "This is longer than we would expect." + + major_repairs_date_value_check: + page_header: "" + check_answer_label: "Major repairs date confirmation" + hint_text: "" + question_text: "Are you sure the property has been vacant for this long?" + title_text: "You told us the property has been vacant for 2 years." + informative_text: "This is longer than we would expect." diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index 3159459ad..cb0aaf06e 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -740,7 +740,7 @@ } ], "title_text": { - "translation": "soft_validations.net_income.title_text", + "translation": "forms.2024.lettings.soft_validations.net_income_value_check.title_text", "arguments": [ { "key": "incfreq", @@ -755,7 +755,7 @@ ] }, "informative_text": { - "translation": "soft_validations.net_income.hint_text", + "translation": "forms.2024.lettings.soft_validations.net_income_value_check.informative_text", "arguments": [ { "key": "net_income_higher_or_lower_text", diff --git a/spec/helpers/interruption_screen_helper_spec.rb b/spec/helpers/interruption_screen_helper_spec.rb index 60cd71131..0d4456f2a 100644 --- a/spec/helpers/interruption_screen_helper_spec.rb +++ b/spec/helpers/interruption_screen_helper_spec.rb @@ -93,7 +93,7 @@ RSpec.describe InterruptionScreenHelper do context "when 1 out of 2 arguments are given" do it "returns an empty string" do informative_text = { - "translation" => "soft_validations.net_income.hint_text", + "translation" => "forms.2024.lettings.soft_validations.net_income_value_check.informative_text", "arguments" => [ { "key" => "ecstat1", diff --git a/spec/models/form/lettings/pages/care_home_charges_value_check_spec.rb b/spec/models/form/lettings/pages/care_home_charges_value_check_spec.rb index 0530cf445..e9c1d5879 100644 --- a/spec/models/form/lettings/pages/care_home_charges_value_check_spec.rb +++ b/spec/models/form/lettings/pages/care_home_charges_value_check_spec.rb @@ -30,12 +30,12 @@ RSpec.describe Form::Lettings::Pages::CareHomeChargesValueCheck, type: :model do it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.care_home_charges.title_text", + "translation" => "forms.2024.lettings.soft_validations.care_home_charges_value_check.title_text", }) end it "has the correct informative_text" do - expect(page.informative_text).to eq("") + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.care_home_charges_value_check.informative_text" }) end it "has the correct interruption_screen_question_ids" do diff --git a/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check_spec.rb b/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check_spec.rb index 0b3d770b3..865fc6fd2 100644 --- a/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check_spec.rb +++ b/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check_spec.rb @@ -37,27 +37,15 @@ RSpec.describe Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPe it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end @@ -82,27 +70,15 @@ RSpec.describe Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPe it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end diff --git a/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check_spec.rb b/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check_spec.rb index f380a5cb9..8ce2e5451 100644 --- a/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check_spec.rb +++ b/spec/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check_spec.rb @@ -37,27 +37,15 @@ RSpec.describe Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPe it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end @@ -82,27 +70,15 @@ RSpec.describe Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPe it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end diff --git a/spec/models/form/lettings/pages/multiple_partners_value_check_spec.rb b/spec/models/form/lettings/pages/multiple_partners_value_check_spec.rb index 551a3b070..f116cb601 100644 --- a/spec/models/form/lettings/pages/multiple_partners_value_check_spec.rb +++ b/spec/models/form/lettings/pages/multiple_partners_value_check_spec.rb @@ -4,7 +4,8 @@ RSpec.describe Form::Lettings::Pages::MultiplePartnersValueCheck, type: :model d subject(:page) { described_class.new(page_id, page_definition, subsection, person_index:) } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } let(:person_index) { 1 } let(:page_id) { "multiple_partners_value_check" } @@ -39,13 +40,13 @@ RSpec.describe Form::Lettings::Pages::MultiplePartnersValueCheck, type: :model d it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.multiple_partners_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.multiple_partners_value_check.title_text", "arguments" => [], }) end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.multiple_partners_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do @@ -71,13 +72,13 @@ RSpec.describe Form::Lettings::Pages::MultiplePartnersValueCheck, type: :model d it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.multiple_partners_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.multiple_partners_value_check.title_text", "arguments" => [], }) end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.multiple_partners_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do diff --git a/spec/models/form/lettings/pages/net_income_value_check_spec.rb b/spec/models/form/lettings/pages/net_income_value_check_spec.rb index 523e02c8b..fe98919ae 100644 --- a/spec/models/form/lettings/pages/net_income_value_check_spec.rb +++ b/spec/models/form/lettings/pages/net_income_value_check_spec.rb @@ -24,13 +24,13 @@ RSpec.describe Form::Lettings::Pages::NetIncomeValueCheck, type: :model do end it "has the correct title_text" do - expect(page.title_text).to eq({ "translation" => "soft_validations.net_income.title_text", "arguments" => [{ "i18n_template" => "incfreq", "key" => "incfreq", "label" => true }, { "arguments_for_key" => "earnings", "i18n_template" => "earnings", "key" => "field_formatted_as_currency" }] }) + expect(page.title_text).to eq({ "translation" => "forms.2024.lettings.soft_validations.net_income_value_check.title_text", "arguments" => [{ "i18n_template" => "incfreq", "key" => "incfreq", "label" => true }, { "arguments_for_key" => "earnings", "i18n_template" => "earnings", "key" => "field_formatted_as_currency" }] }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ "arguments" => [{ "i18n_template" => "net_income_higher_or_lower_text", "key" => "net_income_higher_or_lower_text", "label" => false }], - "translation" => "soft_validations.net_income.hint_text", + "translation" => "forms.2024.lettings.soft_validations.net_income_value_check.informative_text", }) end end diff --git a/spec/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check_spec.rb b/spec/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check_spec.rb index 286ac6183..6cf6302f8 100644 --- a/spec/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check_spec.rb +++ b/spec/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check_spec.rb @@ -37,27 +37,15 @@ RSpec.describe Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCh it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end @@ -82,27 +70,15 @@ RSpec.describe Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCh it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end diff --git a/spec/models/form/lettings/pages/no_females_pregnant_household_person_value_check_spec.rb b/spec/models/form/lettings/pages/no_females_pregnant_household_person_value_check_spec.rb index 205f19ae1..f986f17d2 100644 --- a/spec/models/form/lettings/pages/no_females_pregnant_household_person_value_check_spec.rb +++ b/spec/models/form/lettings/pages/no_females_pregnant_household_person_value_check_spec.rb @@ -37,27 +37,15 @@ RSpec.describe Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end @@ -82,27 +70,15 @@ RSpec.describe Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.pregnancy.title", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.title_text", + "arguments" => [], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.pregnancy.all_male_tenants", - "arguments" => [ - { - "key" => "sex1", - "label" => true, - "i18n_template" => "sex1", - }, - ], + "translation" => "forms.2024.lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check.informative_text", + "arguments" => [], }) end end diff --git a/spec/models/form/lettings/pages/partner_under16_value_check_spec.rb b/spec/models/form/lettings/pages/partner_under16_value_check_spec.rb index a769f95cc..168f4ca91 100644 --- a/spec/models/form/lettings/pages/partner_under16_value_check_spec.rb +++ b/spec/models/form/lettings/pages/partner_under16_value_check_spec.rb @@ -4,7 +4,8 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do subject(:page) { described_class.new(page_id, page_definition, subsection, person_index:) } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } let(:person_index) { 1 } let(:page_id) { "partner_under_16_value_check" } @@ -39,7 +40,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.partner_under_16_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.title_text", "arguments" => [ { "key" => "age1", @@ -51,7 +52,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do @@ -77,7 +78,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.partner_under_16_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.title_text", "arguments" => [ { "key" => "age2", @@ -89,7 +90,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do @@ -115,7 +116,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.partner_under_16_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.title_text", "arguments" => [ { "key" => "age3", @@ -127,7 +128,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do @@ -153,7 +154,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.partner_under_16_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.title_text", "arguments" => [ { "key" => "age4", @@ -165,7 +166,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do @@ -191,7 +192,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.partner_under_16_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.title_text", "arguments" => [ { "key" => "age5", @@ -203,7 +204,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do @@ -229,7 +230,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.partner_under_16_lettings.title", + "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.title_text", "arguments" => [ { "key" => "age6", @@ -241,7 +242,7 @@ RSpec.describe Form::Lettings::Pages::PartnerUnder16ValueCheck, type: :model do end it "has correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.partner_under_16_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do diff --git a/spec/models/form/lettings/pages/person_over_retirement_value_check_spec.rb b/spec/models/form/lettings/pages/person_over_retirement_value_check_spec.rb index ec00f0d75..c8a482ee4 100644 --- a/spec/models/form/lettings/pages/person_over_retirement_value_check_spec.rb +++ b/spec/models/form/lettings/pages/person_over_retirement_value_check_spec.rb @@ -28,13 +28,14 @@ RSpec.describe Form::Lettings::Pages::PersonOverRetirementValueCheck, type: :mod it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.retirement.max.title", + "translation" => "forms.2024.lettings.soft_validations.retirement_value_check.title_text", }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.retirement.max.hint_text", + "translation" => "forms.2024.lettings.soft_validations.retirement_value_check.informative_text", + "arguments" => [], }) end end @@ -50,13 +51,14 @@ RSpec.describe Form::Lettings::Pages::PersonOverRetirementValueCheck, type: :mod it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.retirement.max.title", + "translation" => "forms.2024.lettings.soft_validations.retirement_value_check.title_text", }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.retirement.max.hint_text", + "translation" => "forms.2024.lettings.soft_validations.retirement_value_check.informative_text", + "arguments" => [], }) end end diff --git a/spec/models/form/lettings/pages/person_under_retirement_value_check_spec.rb b/spec/models/form/lettings/pages/person_under_retirement_value_check_spec.rb index 37ca94f9e..6226e0309 100644 --- a/spec/models/form/lettings/pages/person_under_retirement_value_check_spec.rb +++ b/spec/models/form/lettings/pages/person_under_retirement_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Pages::PersonUnderRetirementValueCheck, type: :mo it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.retirement.min.title", + "translation" => "forms.2024.lettings.soft_validations.no_retirement_value_check.title_text", "arguments" => [ { "key" => "age2", @@ -40,7 +40,7 @@ RSpec.describe Form::Lettings::Pages::PersonUnderRetirementValueCheck, type: :mo end it "has the correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.no_retirement_value_check.informative_text" }) end end @@ -55,7 +55,7 @@ RSpec.describe Form::Lettings::Pages::PersonUnderRetirementValueCheck, type: :mo it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.retirement.min.title", + "translation" => "forms.2024.lettings.soft_validations.no_retirement_value_check.title_text", "arguments" => [ { "key" => "age3", @@ -67,7 +67,7 @@ RSpec.describe Form::Lettings::Pages::PersonUnderRetirementValueCheck, type: :mo end it "has the correct informative_text" do - expect(page.informative_text).to eq({}) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.lettings.soft_validations.no_retirement_value_check.informative_text" }) 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 b97717077..b45f86fce 100644 --- a/spec/models/form/lettings/subsections/household_characteristics_spec.rb +++ b/spec/models/form/lettings/subsections/household_characteristics_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :mod let(:subsection_id) { nil } let(:subsection_definition) { nil } let(:section) { instance_double(Form::Lettings::Sections::Household) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do allow(section).to receive(:form).and_return(form) diff --git a/spec/models/form/lettings/subsections/household_needs_spec.rb b/spec/models/form/lettings/subsections/household_needs_spec.rb index 6e4dd25f1..dcd957601 100644 --- a/spec/models/form/lettings/subsections/household_needs_spec.rb +++ b/spec/models/form/lettings/subsections/household_needs_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Lettings::Subsections::HouseholdNeeds, type: :model do let(:subsection_id) { nil } let(:subsection_definition) { nil } - let(:section) { instance_double(Form::Lettings::Sections::Household) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:section) { instance_double(Form::Lettings::Sections::Household, form:) } it "has correct section" do expect(household_needs.section).to eq(section) diff --git a/spec/models/form/lettings/subsections/household_situation_spec.rb b/spec/models/form/lettings/subsections/household_situation_spec.rb index b9f65dbdd..d672b3ccc 100644 --- a/spec/models/form/lettings/subsections/household_situation_spec.rb +++ b/spec/models/form/lettings/subsections/household_situation_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do let(:subsection_id) { nil } let(:subsection_definition) { nil } let(:section) { instance_double(Form::Lettings::Sections::Household) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } before do allow(section).to receive(:form).and_return(form) diff --git a/spec/models/form/lettings/subsections/income_and_benefits_spec.rb b/spec/models/form/lettings/subsections/income_and_benefits_spec.rb index 4c92faaf6..7bdc26bfa 100644 --- a/spec/models/form/lettings/subsections/income_and_benefits_spec.rb +++ b/spec/models/form/lettings/subsections/income_and_benefits_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Lettings::Subsections::IncomeAndBenefits, type: :model do let(:subsection_id) { nil } let(:subsection_definition) { nil } - let(:section) { instance_double(Form::Lettings::Sections::RentAndCharges) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:section) { instance_double(Form::Lettings::Sections::RentAndCharges, form:) } it "has correct section" do expect(income_and_benefits.section).to eq(section) diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index 8161f8a00..591ffdd53 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -1851,8 +1851,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "populates with correct error message" do parser.valid? - expect(parser.errors.where(:field_46, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired.") - expect(parser.errors.where(:field_50, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired.") + expect(parser.errors.where(:field_46, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") + expect(parser.errors.where(:field_50, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") end end diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index e33458eb4..e9047b2ae 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -1881,8 +1881,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "populates with correct error message" do parser.valid? - expect(parser.errors.where(:field_42, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired.") - expect(parser.errors.where(:field_46, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired.") + expect(parser.errors.where(:field_42, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") + expect(parser.errors.where(:field_46, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") end end From 61eb0057f637b110bc83b9c1b7ca1c6190aeb3b7 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 11 Nov 2024 16:41:13 +0000 Subject: [PATCH 12/27] CLDC-3693: Extract shared validations (#2744) * Extract lettings household validation from shared validations * Extract lettings setup validation from shared validations * Extract only shared validations --- app/models/user.rb | 2 +- .../validations/household_validations.rb | 9 ++- .../validations/property_validations.rb | 8 ++ .../sales/household_validations.rb | 9 ++- .../validations/sales/property_validations.rb | 8 ++ .../validations/sales/setup_validations.rb | 8 ++ app/models/validations/setup_validations.rb | 49 ++++++++++-- app/models/validations/shared_validations.rb | 80 +++---------------- config/locales/en.yml | 35 +------- .../validations/lettings/household.en.yml | 7 ++ .../lettings/property_information.en.yml | 6 ++ .../locales/validations/lettings/setup.en.yml | 35 ++++++-- .../sales/property_information.en.yml | 7 +- config/locales/validations/sales/setup.en.yml | 1 + config/locales/validations/shared.en.yml | 19 +++++ .../generate_lettings_documentation.rake | 4 +- lib/tasks/generate_sales_documentation.rake | 4 +- .../form/sales/pages/la_nominations_spec.rb | 8 +- .../sales/pages/last_accommodation_la_spec.rb | 6 +- .../sales/pages/last_accommodation_spec.rb | 6 +- .../validations/date_validations_spec.rb | 2 +- .../validations/household_validations_spec.rb | 14 ++-- .../validations/setup_validations_spec.rb | 42 +++++----- .../validations/shared_validations_spec.rb | 34 ++++---- .../validations/tenancy_validations_spec.rb | 4 +- .../requests/lettings_logs_controller_spec.rb | 2 +- 26 files changed, 222 insertions(+), 187 deletions(-) create mode 100644 config/locales/validations/lettings/household.en.yml create mode 100644 config/locales/validations/lettings/property_information.en.yml create mode 100644 config/locales/validations/shared.en.yml diff --git a/app/models/user.rb b/app/models/user.rb index 75b5a366b..3d6dbe893 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,7 +19,7 @@ class User < ApplicationRecord validates :password, presence: { if: :password_required? } validates :password, length: { within: Devise.password_length, allow_blank: true } validates :password, confirmation: { if: :password_required? } - validates :phone_extension, format: { with: /\A\d+\z/, allow_blank: true, message: I18n.t("validations.numeric.format", field: "") } + validates :phone_extension, format: { with: /\A\d+\z/, allow_blank: true, message: I18n.t("validations.not_number", field: "") } after_validation :send_data_protection_confirmation_reminder, if: :is_dpo_changed? diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb index 626925631..703e9f394 100644 --- a/app/models/validations/household_validations.rb +++ b/app/models/validations/household_validations.rb @@ -52,7 +52,14 @@ module Validations::HouseholdValidations end def validate_partner_count(record) - shared_validate_partner_count(record, 8) + return if record.form.start_year_2024_or_later? + + partner_numbers = (2..8).select { |n| person_is_partner?(record["relat#{n}"]) } + if partner_numbers.count > 1 + partner_numbers.each do |n| + record.errors.add "relat#{n}", I18n.t("validations.lettings.household.relat.one_partner") + end + end end def validate_person_1_economic(record) diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index e0246ff1f..1864adc5c 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -57,4 +57,12 @@ module Validations::PropertyValidations record.errors.add :uprn, I18n.t("validations.property.uprn.invalid") end + + def validate_property_postcode(record) + postcode = record.postcode_full + if record.postcode_known? && (postcode.blank? || !postcode.match(POSTCODE_REGEXP)) + error_message = I18n.t("validations.lettings.property_information.postcode_full.invalid") + record.errors.add :postcode_full, :wrong_format, message: error_message + end + end end diff --git a/app/models/validations/sales/household_validations.rb b/app/models/validations/sales/household_validations.rb index 23b2e9ee1..175474098 100644 --- a/app/models/validations/sales/household_validations.rb +++ b/app/models/validations/sales/household_validations.rb @@ -2,7 +2,14 @@ module Validations::Sales::HouseholdValidations include Validations::SharedValidations def validate_partner_count(record) - shared_validate_partner_count(record, 6) + return if record.form.start_year_2024_or_later? + + partner_numbers = (2..6).select { |n| person_is_partner?(record["relat#{n}"]) } + if partner_numbers.count > 1 + partner_numbers.each do |n| + record.errors.add "relat#{n}", I18n.t("validations.sales.household.relat.one_partner") + end + end end def validate_buyers_living_in_property(record) diff --git a/app/models/validations/sales/property_validations.rb b/app/models/validations/sales/property_validations.rb index c4a42c630..5cf70ed8d 100644 --- a/app/models/validations/sales/property_validations.rb +++ b/app/models/validations/sales/property_validations.rb @@ -28,4 +28,12 @@ module Validations::Sales::PropertyValidations record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.invalid") end + + def validate_property_postcode(record) + postcode = record.postcode_full + if record.postcode_known? && (postcode.blank? || !postcode.match(POSTCODE_REGEXP)) + error_message = I18n.t("validations.sales.property_information.postcode_full.invalid") + record.errors.add :postcode_full, :wrong_format, message: error_message + end + end end diff --git a/app/models/validations/sales/setup_validations.rb b/app/models/validations/sales/setup_validations.rb index 6fdc2f1a3..75e79f15a 100644 --- a/app/models/validations/sales/setup_validations.rb +++ b/app/models/validations/sales/setup_validations.rb @@ -58,6 +58,14 @@ module Validations::Sales::SetupValidations end end + def validate_owning_organisation_data_sharing_agremeent_signed(record) + return if record.skip_dpo_validation + + if record.owning_organisation_id_changed? && record.owning_organisation.present? && !record.owning_organisation.data_protection_confirmed? + record.errors.add :owning_organisation_id, I18n.t("validations.sales.setup.owning_organisation.data_sharing_agreement_not_signed") + end + end + private def active_collection_start_date diff --git a/app/models/validations/setup_validations.rb b/app/models/validations/setup_validations.rb index d8e5dbf93..8d1884fc2 100644 --- a/app/models/validations/setup_validations.rb +++ b/app/models/validations/setup_validations.rb @@ -72,17 +72,15 @@ module Validations::SetupValidations end end - def validate_scheme_has_confirmed_locations_validation(record) + def validate_scheme(record) return unless record.scheme - unless record.scheme.locations.confirmed.any? - record.errors.add :scheme_id, :no_completed_locations, message: I18n.t("validations.lettings.setup.scheme.no_completed_locations") + if record.scheme.status == :incomplete + record.errors.add :scheme_id, :incomplete, message: I18n.t("validations.lettings.setup.scheme.incomplete") end - end - def validate_scheme(record) - if record.scheme&.status == :incomplete - record.errors.add :scheme_id, :incomplete, message: I18n.t("validations.lettings.setup.scheme.incomplete") + if record.scheme.locations.nil? || (record.scheme.locations.present? && record.scheme.locations.confirmed.none?) + record.errors.add :scheme_id, :no_completed_locations, message: I18n.t("validations.lettings.setup.scheme.no_completed_locations") end scheme_during_startdate_validation(record) @@ -98,6 +96,35 @@ module Validations::SetupValidations end end + def location_during_startdate_validation(record) + location_inactive_status = inactive_status(record.startdate, record.location) + + if location_inactive_status.present? + date, scope, deactivation_date = location_inactive_status.values_at(:date, :scope, :deactivation_date) + record.errors.add :startdate, :not_active, message: I18n.t("validations.lettings.setup.startdate.location.#{scope}.startdate", postcode: record.location.postcode, date:, deactivation_date:) + record.errors.add :location_id, :not_active, message: I18n.t("validations.lettings.setup.startdate.location.#{scope}.location_id", postcode: record.location.postcode, date:, deactivation_date:) + record.errors.add :scheme_id, :not_active, message: I18n.t("validations.lettings.setup.startdate.location.#{scope}.location_id", postcode: record.location.postcode, date:, deactivation_date:) + end + end + + def scheme_during_startdate_validation(record) + scheme_inactive_status = inactive_status(record.startdate, record.scheme) + + if scheme_inactive_status.present? + date, scope, deactivation_date = scheme_inactive_status.values_at(:date, :scope, :deactivation_date) + record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.scheme.#{scope}.startdate", name: record.scheme.service_name, date:, deactivation_date:) + record.errors.add :scheme_id, I18n.t("validations.lettings.setup.startdate.scheme.#{scope}.scheme_id", name: record.scheme.service_name, date:, deactivation_date:) + end + end + + def tenancy_startdate_with_scheme_locations(record) + return if record.scheme.blank? || record.startdate.blank? + return if record.scheme.has_active_locations_on_date?(record.startdate) + + record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.scheme.locations_inactive.startdate", name: record.scheme.service_name) + record.errors.add :scheme_id, I18n.t("validations.lettings.setup.startdate.scheme.locations_inactive.scheme_id", name: record.scheme.service_name) + end + def validate_managing_organisation_data_sharing_agremeent_signed(record) return if record.skip_dpo_validation @@ -106,6 +133,14 @@ module Validations::SetupValidations end end + def validate_owning_organisation_data_sharing_agremeent_signed(record) + return if record.skip_dpo_validation + + if record.owning_organisation_id_changed? && record.owning_organisation.present? && !record.owning_organisation.data_protection_confirmed? + record.errors.add :owning_organisation_id, I18n.t("validations.lettings.setup.owning_organisation.data_sharing_agreement_not_signed") + end + end + private def active_collection_start_date diff --git a/app/models/validations/shared_validations.rb b/app/models/validations/shared_validations.rb index 2eb5fff5a..da79599ee 100644 --- a/app/models/validations/shared_validations.rb +++ b/app/models/validations/shared_validations.rb @@ -7,12 +7,12 @@ module Validations::SharedValidations main_field_label = main_label || main_field.to_s.humanize(capitalize: false) other_field_label = other_label || other_field.to_s.humanize(capitalize: false) if record[main_field] == value_other && record[other_field].blank? - record.errors.add main_field.to_sym, I18n.t("validations.other_field_missing", main_field_label:, other_field_label:) - record.errors.add other_field.to_sym, I18n.t("validations.other_field_missing", main_field_label:, other_field_label:) + record.errors.add main_field.to_sym, I18n.t("validations.shared.other_field_missing", main_field_label:, other_field_label:) + record.errors.add other_field.to_sym, I18n.t("validations.shared.other_field_missing", main_field_label:, other_field_label:) end if record[main_field] != value_other && record[other_field].present? - record.errors.add other_field.to_sym, I18n.t("validations.other_field_not_required", main_field_label:, other_field_label:) + record.errors.add other_field.to_sym, I18n.t("validations.shared.other_field_not_required", main_field_label:, other_field_label:) end end @@ -22,7 +22,7 @@ module Validations::SharedValidations next if record.send("#{question.id}_before_type_cast").to_s.match?(/\A\d+(\.\d+)?\z/) field = question.check_answer_label || question.id - record.errors.add question.id.to_sym, I18n.t("validations.numeric.format", field:) + record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.format", field:) end end @@ -55,46 +55,17 @@ module Validations::SharedValidations incorrect_accuracy = (value.to_d * 100) % (question.step * 100) != 0 if question.step < 1 && incorrect_accuracy - record.errors.add question.id.to_sym, I18n.t("validations.numeric.nearest_hundredth", field:) + record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_hundredth", field:) elsif incorrect_accuracy || value.to_d != value.to_i # if the user enters a value in exponent notation (eg '4e1') the to_i method does not convert this to the correct value field = question.check_answer_label || question.id case question.step - when 1 then record.errors.add question.id.to_sym, :not_integer, message: I18n.t("validations.numeric.whole_number", field:) - when 10 then record.errors.add question.id.to_sym, I18n.t("validations.numeric.nearest_ten", field:) + when 1 then record.errors.add question.id.to_sym, :not_integer, message: I18n.t("validations.shared.numeric.whole_number", field:) + when 10 then record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_ten", field:) end end end end - def validate_property_postcode(record) - postcode = record.postcode_full - if record.postcode_known? && (postcode.blank? || !postcode.match(POSTCODE_REGEXP)) - error_message = I18n.t("validations.postcode") - record.errors.add :postcode_full, :wrong_format, message: error_message - end - end - - def location_during_startdate_validation(record) - location_inactive_status = inactive_status(record.startdate, record.location) - - if location_inactive_status.present? - date, scope, deactivation_date = location_inactive_status.values_at(:date, :scope, :deactivation_date) - record.errors.add :startdate, :not_active, message: I18n.t("validations.setup.startdate.location.#{scope}.startdate", postcode: record.location.postcode, date:, deactivation_date:) - record.errors.add :location_id, :not_active, message: I18n.t("validations.setup.startdate.location.#{scope}.location_id", postcode: record.location.postcode, date:, deactivation_date:) - record.errors.add :scheme_id, :not_active, message: I18n.t("validations.setup.startdate.location.#{scope}.location_id", postcode: record.location.postcode, date:, deactivation_date:) - end - end - - def scheme_during_startdate_validation(record) - scheme_inactive_status = inactive_status(record.startdate, record.scheme) - - if scheme_inactive_status.present? - date, scope, deactivation_date = scheme_inactive_status.values_at(:date, :scope, :deactivation_date) - record.errors.add :startdate, I18n.t("validations.setup.startdate.scheme.#{scope}.startdate", name: record.scheme.service_name, date:, deactivation_date:) - record.errors.add :scheme_id, I18n.t("validations.setup.startdate.scheme.#{scope}.scheme_id", name: record.scheme.service_name, date:, deactivation_date:) - end - end - def inactive_status(date, resource) return if date.blank? || resource.blank? @@ -117,46 +88,15 @@ module Validations::SharedValidations { scope: status, date: date&.to_formatted_s(:govuk_date), deactivation_date: closest_reactivation&.deactivation_date&.to_formatted_s(:govuk_date) } end - def tenancy_startdate_with_scheme_locations(record) - return if record.scheme.blank? || record.startdate.blank? - return if record.scheme.has_active_locations_on_date?(record.startdate) - - record.errors.add :startdate, I18n.t("validations.setup.startdate.scheme.locations_inactive.startdate", name: record.scheme.service_name) - record.errors.add :scheme_id, I18n.t("validations.setup.startdate.scheme.locations_inactive.scheme_id", name: record.scheme.service_name) - end - - def shared_validate_partner_count(record, max_people) - return if record.form.start_year_2024_or_later? - - partner_numbers = (2..max_people).select { |n| person_is_partner?(record["relat#{n}"]) } - if partner_numbers.count > 1 - partner_numbers.each do |n| - if record.sales? - record.errors.add "relat#{n}", I18n.t("validations.sales.household.relat.one_partner") - else - record.errors.add "relat#{n}", I18n.t("validations.household.relat.one_partner") - end - end - end - end - def date_valid?(question, record) if record[question].is_a?(ActiveSupport::TimeWithZone) && record[question].year.zero? - record.errors.add question, I18n.t("validations.date.invalid_date") + record.errors.add question, I18n.t("validations.shared.date.invalid_date") false else true end end - def validate_owning_organisation_data_sharing_agremeent_signed(record) - return if record.skip_dpo_validation - - if record.owning_organisation_id_changed? && record.owning_organisation.present? && !record.owning_organisation.data_protection_confirmed? - record.errors.add :owning_organisation_id, I18n.t("validations.setup.owning_organisation.data_sharing_agreement_not_signed") - end - end - private def person_is_partner?(relationship) @@ -169,9 +109,9 @@ private max = [question.prefix, number_with_delimiter(question.max, delimiter: ","), question.suffix].join("") if question.max if min && max - record.errors.add question.id.to_sym, :outside_the_range, message: I18n.t("validations.numeric.within_range", field:, min:, max:) + record.errors.add question.id.to_sym, :outside_the_range, message: I18n.t("validations.shared.numeric.within_range", field:, min:, max:) elsif min - record.errors.add question.id.to_sym, :under_min, message: I18n.t("validations.numeric.above_min", field:, min:) + record.errors.add question.id.to_sym, :under_min, message: I18n.t("validations.shared.numeric.above_min", field:, min:) end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 55044b7a6..4c601b353 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -239,23 +239,12 @@ en: merged: "That organisation has already been merged. Select a different organisation." scheme_duplicates_not_resolved: "You must resolve all duplicates or indicate that there are no duplicates" not_answered: "You must answer %{question}" + not_number: "%{field} must be a number." invalid_option: "Enter a valid value for %{question}" invalid_number: "Enter a number for %{question}" no_address_found: "We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site." - other_field_missing: "If %{main_field_label} is other then %{other_field_label} must be provided." - other_field_not_required: "%{other_field_label} must not be provided if %{main_field_label} was not other." - numeric: - within_range: "%{field} must be between %{min} and %{max}." - above_min: "%{field} must be at least %{min}." - whole_number: "%{field} must be a whole number." - nearest_ten: "%{field} must be given to the nearest ten." - nearest_hundredth: "%{field} must be given to the nearest hundredth." - normal_format: "Enter a number." - format: "%{field} must be a number." - date: - invalid_date: "Enter a date in the correct format, for example 31 1 2024." outside_collection_window: "Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year}." postcode: "Enter a postcode in the correct format, for example AA1 1AA." location_admin_district: "Select a local authority." @@ -271,29 +260,8 @@ en: year_not_two_or_four_digits: "Sale completion year must be 2 or 4 digits." type: percentage_bought_must_be_at_least_threshold: "The minimum increase in equity while staircasing is %{threshold}% for this shared ownership type." - startdate: before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme." - location: - deactivated: - startdate: "The location %{postcode} is inactive on this date. Enter another date or choose another location." - location_id: "This location is not active on the tenancy start date. Choose another location or edit the tenancy start date." - activating_soon: - startdate: "The location %{postcode} is not available until %{date}. Enter a tenancy start date after %{date}." - location_id: "The location %{postcode} is not available until %{date}. Select another location or edit the tenancy start date." - reactivating_soon: - startdate: "The location %{postcode} is not available until %{date}. Enter a tenancy start date after %{date}." - location_id: "The location %{postcode} is not available until %{date}. Select another location or edit the tenancy start date." - scheme: - deactivated: - startdate: "The scheme %{name} was deactivated on %{date} and was not available on the day you entered. Select another scheme or edit the tenancy start date." - scheme_id: "The scheme %{name} was deactivated on %{date} and was not available on the day you entered. Select another scheme or edit the tenancy start date." - reactivating_soon: - startdate: "The scheme %{name} is not available until %{date}. Enter a tenancy start date after %{date}." - scheme_id: "The scheme %{name} is not available until %{date}. Select another scheme or edit the tenancy start date." - locations_inactive: - startdate: "The scheme %{name} has no locations that are active on this date. Enter another date or choose another scheme." - scheme_id: "The scheme %{name} has no locations that are active on this date. Enter another date or choose another scheme." owning_organisation: data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation." property: @@ -451,7 +419,6 @@ en: cannot_be_student: "Person cannot be a student if they are aged 16-19 but are not a child." relat: child_under_16_lettings: "Answer cannot be ‘partner’ as you told us person %{person_num}'s age is under 16." - one_partner: "Number of partners cannot be greater than 1." not_student_16_19: "Answer cannot be ‘child’ as you told us the person %{person_num} is between 16 and 19 and is not a full-time student." student_16_19: cannot_be_child: diff --git a/config/locales/validations/lettings/household.en.yml b/config/locales/validations/lettings/household.en.yml new file mode 100644 index 000000000..b9573f4d2 --- /dev/null +++ b/config/locales/validations/lettings/household.en.yml @@ -0,0 +1,7 @@ +en: + validations: + lettings: + household: + relat: + one_partner: "Number of partners cannot be greater than 1." + diff --git a/config/locales/validations/lettings/property_information.en.yml b/config/locales/validations/lettings/property_information.en.yml new file mode 100644 index 000000000..ed42acb4c --- /dev/null +++ b/config/locales/validations/lettings/property_information.en.yml @@ -0,0 +1,6 @@ +en: + validations: + lettings: + property_information: + postcode_full: + invalid: "Enter a postcode in the correct format, for example AA1 1AA." diff --git a/config/locales/validations/lettings/setup.en.yml b/config/locales/validations/lettings/setup.en.yml index d2ee9bf0f..96b5af04b 100644 --- a/config/locales/validations/lettings/setup.en.yml +++ b/config/locales/validations/lettings/setup.en.yml @@ -21,12 +21,40 @@ en: owning_organisation: "Enter a date when the owning organisation was active. %{owning_organisation} became active on %{available_from}." managing_organisation: "Enter a date when the managing organisation was active. %{managing_organisation} became active on %{available_from}." different_organisations: "Enter a date when the owning and managing organisations were active. %{owning_organisation} became active on %{owning_organisation_active_from}, and %{managing_organisation} became active on %{managing_organisation_active_from}." + location: + deactivated: + startdate: "The location %{postcode} is inactive on this date. Enter another date or choose another location." + location_id: "This location is not active on the tenancy start date. Choose another location or edit the tenancy start date." + activating_soon: + startdate: "The location %{postcode} is not available until %{date}. Enter a tenancy start date after %{date}." + location_id: "The location %{postcode} is not available until %{date}. Select another location or edit the tenancy start date." + reactivating_soon: + startdate: "The location %{postcode} is not available until %{date}. Enter a tenancy start date after %{date}." + location_id: "The location %{postcode} is not available until %{date}. Select another location or edit the tenancy start date." + scheme: + deactivated: + startdate: "The scheme %{name} was deactivated on %{date} and was not available on the day you entered. Select another scheme or edit the tenancy start date." + scheme_id: "The scheme %{name} was deactivated on %{date} and was not available on the day you entered. Select another scheme or edit the tenancy start date." + reactivating_soon: + startdate: "The scheme %{name} is not available until %{date}. Enter a tenancy start date after %{date}." + scheme_id: "The scheme %{name} is not available until %{date}. Select another scheme or edit the tenancy start date." + locations_inactive: + startdate: "The scheme %{name} has no locations that are active on this date. Enter another date or choose another scheme." + scheme_id: "The scheme %{name} has no locations that are active on this date. Enter another date or choose another scheme." + + scheme: + incomplete: "This scheme is incomplete. Select another scheme or update this one." + no_completed_locations: "This scheme cannot be chosen as it has no completed locations." + + location: + incomplete: "This location is incomplete. Select another location or update this one." assigned_to: invalid: "Please select the owning organisation or managing organisation that you belong to." owning_organisation: invalid: "Please select the owning organisation or managing organisation that you belong to." + data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation." inactive: merged_organisation: "The owning organisation must be active on the tenancy start date. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}." @@ -44,10 +72,3 @@ en: intermediate_rent_product_name: blank: "Enter name of other intermediate rent product." - - scheme: - incomplete: "This scheme is incomplete. Select another scheme or update this one." - no_completed_locations: "This scheme cannot be chosen as it has no completed locations." - - location: - incomplete: "This location is incomplete. Select another location or update this one." diff --git a/config/locales/validations/sales/property_information.en.yml b/config/locales/validations/sales/property_information.en.yml index e69f90edf..a91e47849 100644 --- a/config/locales/validations/sales/property_information.en.yml +++ b/config/locales/validations/sales/property_information.en.yml @@ -3,11 +3,12 @@ en: sales: property_information: postcode_full: - postcode_must_match_previous: + postcode_must_match_previous: joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." + invalid: "Enter a postcode in the correct format, for example AA1 1AA." ppostcode_full: - postcode_must_match_previous: + postcode_must_match_previous: joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." ownershipsch: @@ -15,7 +16,7 @@ en: joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." uprn: - postcode_must_match_previous: + postcode_must_match_previous: joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." invalid: "UPRN must be 12 digits or less." diff --git a/config/locales/validations/sales/setup.en.yml b/config/locales/validations/sales/setup.en.yml index 9dd13b525..62819a029 100644 --- a/config/locales/validations/sales/setup.en.yml +++ b/config/locales/validations/sales/setup.en.yml @@ -17,6 +17,7 @@ en: "Enter a date when the owning organisation was active. %{owning_organisation} became active on %{available_from}." owning_organisation: + data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation." inactive: merged_organisation: "The owning organisation must be active on the sale completion date. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}." diff --git a/config/locales/validations/shared.en.yml b/config/locales/validations/shared.en.yml new file mode 100644 index 000000000..a29d2bd74 --- /dev/null +++ b/config/locales/validations/shared.en.yml @@ -0,0 +1,19 @@ +en: + validations: + shared: + other_field_missing: "If %{main_field_label} is other then %{other_field_label} must be provided." + other_field_not_required: "%{other_field_label} must not be provided if %{main_field_label} was not other." + + numeric: + within_range: "%{field} must be between %{min} and %{max}." + above_min: "%{field} must be at least %{min}." + whole_number: "%{field} must be a whole number." + nearest_ten: "%{field} must be given to the nearest ten." + nearest_hundredth: "%{field} must be given to the nearest hundredth." + normal_format: "Enter a number." + format: "%{field} must be a number." + + postcode: "Enter a postcode in the correct format, for example AA1 1AA." + + date: + invalid_date: "Enter a date in the correct format, for example 31 1 2024." diff --git a/lib/tasks/generate_lettings_documentation.rake b/lib/tasks/generate_lettings_documentation.rake index 8b11e3ff5..3dc8e71b4 100644 --- a/lib/tasks/generate_lettings_documentation.rake +++ b/lib/tasks/generate_lettings_documentation.rake @@ -60,13 +60,13 @@ namespace :generate_lettings_documentation do min = [question.prefix, question.min].join("") if question.min max = [question.prefix, question.max].join("") if question.max - error_message = I18n.t("validations.numeric.above_min", field:, min:) + error_message = I18n.t("validations.shared.numeric.above_min", field:, min:) validation_name = "minimum" validation_description = "Field value is lower than the minimum value" if min && max validation_name = "range" - error_message = I18n.t("validations.numeric.within_range", field:, min:, max:) + error_message = I18n.t("validations.shared.numeric.within_range", field:, min:, max:) validation_description = "Field value is lower than the minimum value or higher than the maximum value" end diff --git a/lib/tasks/generate_sales_documentation.rake b/lib/tasks/generate_sales_documentation.rake index 62272f6f8..c595c4f18 100644 --- a/lib/tasks/generate_sales_documentation.rake +++ b/lib/tasks/generate_sales_documentation.rake @@ -59,13 +59,13 @@ namespace :generate_sales_documentation do min = [question.prefix, question.min].join("") if question.min max = [question.prefix, question.max].join("") if question.max - error_message = I18n.t("validations.numeric.above_min", field:, min:) + error_message = I18n.t("validations.shared.numeric.above_min", field:, min:) validation_name = "minimum" validation_description = "Field value is lower than the minimum value" if min && max validation_name = "range" - error_message = I18n.t("validations.numeric.within_range", field:, min:, max:) + error_message = I18n.t("validations.shared.numeric.within_range", field:, min:, max:) validation_description = "Field value is lower than the minimum value or higher than the maximum value" end diff --git a/spec/models/form/sales/pages/la_nominations_spec.rb b/spec/models/form/sales/pages/la_nominations_spec.rb index 036e26092..190afaa86 100644 --- a/spec/models/form/sales/pages/la_nominations_spec.rb +++ b/spec/models/form/sales/pages/la_nominations_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Form::Sales::Pages::LaNominations, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:start_year_after_2024) { false } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_after_2024) } + let(:start_year_2024_or_later) { false } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_2024_or_later) } let(:subsection) { instance_double(Form::Subsection, form:) } before do @@ -32,7 +32,7 @@ RSpec.describe Form::Sales::Pages::LaNominations, type: :model do end context "with 23/24 log" do - let(:start_year_after_2024) { false } + let(:start_year_2024_or_later) { false } it "has correct routed to" do log.staircase = 1 @@ -41,7 +41,7 @@ RSpec.describe Form::Sales::Pages::LaNominations, type: :model do end context "with 24/25 log" do - let(:start_year_after_2024) { true } + let(:start_year_2024_or_later) { true } it "has correct routed to when staircase is yes" do log.staircase = 1 diff --git a/spec/models/form/sales/pages/last_accommodation_la_spec.rb b/spec/models/form/sales/pages/last_accommodation_la_spec.rb index 9cdd64957..7689e7dfd 100644 --- a/spec/models/form/sales/pages/last_accommodation_la_spec.rb +++ b/spec/models/form/sales/pages/last_accommodation_la_spec.rb @@ -5,8 +5,8 @@ RSpec.describe Form::Sales::Pages::LastAccommodationLa, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:start_year_after_2024) { false } - let(:form) { instance_double(Form, depends_on_met: true, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_after_2024) } + let(:start_year_2024_or_later) { false } + let(:form) { instance_double(Form, depends_on_met: true, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_2024_or_later) } let(:subsection) { instance_double(Form::Subsection, form:, depends_on: nil, enabled?: true) } let(:log) { build(:sales_log, :completed) } @@ -38,7 +38,7 @@ RSpec.describe Form::Sales::Pages::LastAccommodationLa, type: :model do end context "with 2024 form" do - let(:start_year_after_2024) { true } + let(:start_year_2024_or_later) { true } it "is routed to for 2024 non discounted sale logs" do log.update!(ownershipsch: 1) diff --git a/spec/models/form/sales/pages/last_accommodation_spec.rb b/spec/models/form/sales/pages/last_accommodation_spec.rb index fbc581b4b..1b2d1ee0a 100644 --- a/spec/models/form/sales/pages/last_accommodation_spec.rb +++ b/spec/models/form/sales/pages/last_accommodation_spec.rb @@ -7,8 +7,8 @@ RSpec.describe Form::Sales::Pages::LastAccommodation, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:start_year_after_2024) { false } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_after_2024) } + let(:start_year_2024_or_later) { false } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: start_year_2024_or_later) } let(:subsection) { instance_double(Form::Subsection, form:, depends_on: nil) } it "has correct subsection" do @@ -37,7 +37,7 @@ RSpec.describe Form::Sales::Pages::LastAccommodation, type: :model do end context "with 2024 form" do - let(:start_year_after_2024) { true } + let(:start_year_2024_or_later) { true } it "is routed to for 2024 non discounted sale logs" do log.update!(ownershipsch: 1) diff --git a/spec/models/validations/date_validations_spec.rb b/spec/models/validations/date_validations_spec.rb index f6c81a088..3ca259b16 100644 --- a/spec/models/validations/date_validations_spec.rb +++ b/spec/models/validations/date_validations_spec.rb @@ -12,7 +12,7 @@ RSpec.describe Validations::DateValidations do it "must be a valid date" do record.startdate = Time.zone.local(0, 7, 1) date_validator.validate_startdate(record) - expect(record.errors["startdate"]).to include(match I18n.t("validations.date.invalid_date")) + expect(record.errors["startdate"]).to include(match I18n.t("validations.shared.date.invalid_date")) end it "does not raise an error when valid" do diff --git a/spec/models/validations/household_validations_spec.rb b/spec/models/validations/household_validations_spec.rb index b240b7b2a..ea472f618 100644 --- a/spec/models/validations/household_validations_spec.rb +++ b/spec/models/validations/household_validations_spec.rb @@ -27,13 +27,13 @@ RSpec.describe Validations::HouseholdValidations do end describe "reason for leaving last settled home validations" do - let(:field) { "validations.other_field_not_required" } + let(:field) { "validations.shared.other_field_not_required" } let(:main_field_label) { "reason" } let(:other_field_label) { "reasonother" } let(:expected_error) { I18n.t(field, main_field_label:, other_field_label:) } context "when reason is other" do - let(:field) { "validations.other_field_missing" } + let(:field) { "validations.shared.other_field_missing" } it "validates that a reason is provided" do record.reason = 20 @@ -251,14 +251,14 @@ RSpec.describe Validations::HouseholdValidations do record.hhmemb = 0 household_validator.validate_numeric_min_max(record) expect(record.errors["hhmemb"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Number of household members", min: 1, max: 8)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Number of household members", min: 1, max: 8)) end it "validates that the number of household members cannot be more than 8" do record.hhmemb = 9 household_validator.validate_numeric_min_max(record) expect(record.errors["hhmemb"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Number of household members", min: 1, max: 8)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Number of household members", min: 1, max: 8)) end it "expects that the number of other household members is between the min and max" do @@ -276,11 +276,11 @@ RSpec.describe Validations::HouseholdValidations do record.relat3 = "P" household_validator.validate_partner_count(record) expect(record.errors["relat2"]) - .to include(match I18n.t("validations.household.relat.one_partner")) + .to include(match I18n.t("validations.lettings.household.relat.one_partner")) expect(record.errors["relat3"]) - .to include(match I18n.t("validations.household.relat.one_partner")) + .to include(match I18n.t("validations.lettings.household.relat.one_partner")) expect(record.errors["relat4"]) - .not_to include(match I18n.t("validations.household.relat.one_partner")) + .not_to include(match I18n.t("validations.lettings.household.relat.one_partner")) end it "expects that a tenant can have a partner" do diff --git a/spec/models/validations/setup_validations_spec.rb b/spec/models/validations/setup_validations_spec.rb index 0c99d3628..5b4f03365 100644 --- a/spec/models/validations/setup_validations_spec.rb +++ b/spec/models/validations/setup_validations_spec.rb @@ -436,9 +436,9 @@ RSpec.describe Validations::SetupValidations do record.scheme = scheme setup_validator.validate_scheme(record) expect(record.errors["startdate"]) - .to include(match I18n.t("validations.setup.startdate.scheme.deactivated.startdate", name: scheme.service_name, date: "4 June 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.scheme.deactivated.startdate", name: scheme.service_name, date: "4 June 2022")) expect(record.errors["scheme_id"]) - .to include(match I18n.t("validations.setup.startdate.scheme.deactivated.scheme_id", name: scheme.service_name, date: "4 June 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.scheme.deactivated.scheme_id", name: scheme.service_name, date: "4 June 2022")) end it "produces no error when tenancy start date is during an active scheme period" do @@ -465,9 +465,9 @@ RSpec.describe Validations::SetupValidations do record.scheme = scheme setup_validator.validate_scheme(record) expect(record.errors["startdate"]) - .to include(match I18n.t("validations.setup.startdate.scheme.reactivating_soon.startdate", name: scheme.service_name, date: "4 August 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.scheme.reactivating_soon.startdate", name: scheme.service_name, date: "4 August 2022")) expect(record.errors["scheme_id"]) - .to include(match I18n.t("validations.setup.startdate.scheme.reactivating_soon.scheme_id", name: scheme.service_name, date: "4 August 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.scheme.reactivating_soon.scheme_id", name: scheme.service_name, date: "4 August 2022")) end it "produces no error when tenancy start date is during an active scheme period" do @@ -498,9 +498,9 @@ RSpec.describe Validations::SetupValidations do record.scheme = scheme setup_validator.validate_scheme(record) expect(record.errors["startdate"]) - .to include(match I18n.t("validations.setup.startdate.scheme.reactivating_soon.startdate", name: scheme.service_name, date: "4 September 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.scheme.reactivating_soon.startdate", name: scheme.service_name, date: "4 September 2022")) expect(record.errors["scheme_id"]) - .to include(match I18n.t("validations.setup.startdate.scheme.reactivating_soon.scheme_id", name: scheme.service_name, date: "4 September 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.scheme.reactivating_soon.scheme_id", name: scheme.service_name, date: "4 September 2022")) end it "produces no error when tenancy start date is during an active scheme period" do @@ -526,8 +526,8 @@ RSpec.describe Validations::SetupValidations do record.startdate = Time.zone.local(2022, 7, 5) record.scheme = scheme setup_validator.validate_scheme(record) - expect(record.errors["startdate"]).to include(match I18n.t("validations.setup.startdate.scheme.locations_inactive.startdate", name: scheme.service_name)) - expect(record.errors["scheme_id"]).to include(match I18n.t("validations.setup.startdate.scheme.locations_inactive.startdate", name: scheme.service_name)) + expect(record.errors["startdate"]).to include(match I18n.t("validations.lettings.setup.startdate.scheme.locations_inactive.startdate", name: scheme.service_name)) + expect(record.errors["scheme_id"]).to include(match I18n.t("validations.lettings.setup.startdate.scheme.locations_inactive.startdate", name: scheme.service_name)) end it "produces no error when scheme has active locations on the tenancy start date" do @@ -553,8 +553,8 @@ RSpec.describe Validations::SetupValidations do record.scheme = scheme record.location = location setup_validator.validate_scheme(record) - expect(record.errors["startdate"]).to include(match I18n.t("validations.setup.startdate.scheme.locations_inactive.startdate", name: scheme.service_name)) - expect(record.errors["startdate"]).not_to include(match I18n.t("validations.setup.startdate.location.deactivated.startdate", postcode: location.postcode)) + expect(record.errors["startdate"]).to include(match I18n.t("validations.lettings.setup.startdate.scheme.locations_inactive.startdate", name: scheme.service_name)) + expect(record.errors["startdate"]).not_to include(match I18n.t("validations.lettings.setup.startdate.location.deactivated.startdate", postcode: location.postcode)) end it "produces no error when scheme has active locations on the tenancy start date" do @@ -593,9 +593,9 @@ RSpec.describe Validations::SetupValidations do record.location = location setup_validator.validate_location(record) expect(record.errors["startdate"]) - .to include(match I18n.t("validations.setup.startdate.location.deactivated.startdate", postcode: location.postcode, date: "4 June 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.deactivated.startdate", postcode: location.postcode, date: "4 June 2022")) expect(record.errors["location_id"]) - .to include(match I18n.t("validations.setup.startdate.location.deactivated.location_id", postcode: location.postcode, date: "4 June 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.deactivated.location_id", postcode: location.postcode, date: "4 June 2022")) end it "produces no error when tenancy start date is during an active location period" do @@ -622,9 +622,9 @@ RSpec.describe Validations::SetupValidations do record.location = location setup_validator.validate_location(record) expect(record.errors["startdate"]) - .to include(match I18n.t("validations.setup.startdate.location.reactivating_soon.startdate", postcode: location.postcode, date: "4 August 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.reactivating_soon.startdate", postcode: location.postcode, date: "4 August 2022")) expect(record.errors["location_id"]) - .to include(match I18n.t("validations.setup.startdate.location.reactivating_soon.location_id", postcode: location.postcode, date: "4 August 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.reactivating_soon.location_id", postcode: location.postcode, date: "4 August 2022")) end it "produces no error when tenancy start date is during an active location period" do @@ -655,9 +655,9 @@ RSpec.describe Validations::SetupValidations do record.location = location setup_validator.validate_location(record) expect(record.errors["startdate"]) - .to include(match I18n.t("validations.setup.startdate.location.reactivating_soon.startdate", postcode: location.postcode, date: "4 September 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.reactivating_soon.startdate", postcode: location.postcode, date: "4 September 2022")) expect(record.errors["location_id"]) - .to include(match I18n.t("validations.setup.startdate.location.reactivating_soon.location_id", postcode: location.postcode, date: "4 September 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.reactivating_soon.location_id", postcode: location.postcode, date: "4 September 2022")) end it "produces no error when tenancy start date is during an active location period" do @@ -686,9 +686,9 @@ RSpec.describe Validations::SetupValidations do record.location = location setup_validator.validate_location(record) expect(record.errors["startdate"]) - .to include(match I18n.t("validations.setup.startdate.location.activating_soon.startdate", postcode: location.postcode, date: "15 September 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.activating_soon.startdate", postcode: location.postcode, date: "15 September 2022")) expect(record.errors["location_id"]) - .to include(match I18n.t("validations.setup.startdate.location.activating_soon.location_id", postcode: location.postcode, date: "15 September 2022")) + .to include(match I18n.t("validations.lettings.setup.startdate.location.activating_soon.location_id", postcode: location.postcode, date: "15 September 2022")) end end @@ -726,7 +726,7 @@ RSpec.describe Validations::SetupValidations do record.startdate = Time.zone.local(2022, 7, 5) record.location = location setup_validator.validate_location(record) - expect(record.errors["startdate"]).to include(match I18n.t("validations.setup.startdate.location.deactivated.startdate", postcode: location.postcode)) + expect(record.errors["startdate"]).to include(match I18n.t("validations.lettings.setup.startdate.location.deactivated.startdate", postcode: location.postcode)) end it "produces no error when the chosen location is active on the tenancy start date" do @@ -900,7 +900,7 @@ RSpec.describe Validations::SetupValidations do it "produces an error" do record.scheme = scheme - setup_validator.validate_scheme_has_confirmed_locations_validation(record) + setup_validator.validate_scheme(record) expect(record.errors["scheme_id"]) .to include(match I18n.t("validations.lettings.setup.scheme.no_completed_locations")) end @@ -914,7 +914,7 @@ RSpec.describe Validations::SetupValidations do it "does not produce an error" do record.scheme = scheme - setup_validator.validate_scheme_has_confirmed_locations_validation(record) + setup_validator.validate_scheme(record) expect(record.errors["scheme_id"]) .to be_empty end diff --git a/spec/models/validations/shared_validations_spec.rb b/spec/models/validations/shared_validations_spec.rb index b4d7fb0b8..53efc6675 100644 --- a/spec/models/validations/shared_validations_spec.rb +++ b/spec/models/validations/shared_validations_spec.rb @@ -18,42 +18,42 @@ RSpec.describe Validations::SharedValidations do lettings_log.age1 = "random" shared_validator.validate_numeric_min_max(lettings_log) expect(lettings_log.errors["age1"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)) end it "validates that other household member ages are a number" do lettings_log.age2 = "random" shared_validator.validate_numeric_min_max(lettings_log) expect(lettings_log.errors["age2"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Person 2’s age", min: 1, max: 120)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Person 2’s age", min: 1, max: 120)) end it "validates that person 1's age is greater than 16" do lettings_log.age1 = 15 shared_validator.validate_numeric_min_max(lettings_log) expect(lettings_log.errors["age1"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)) end it "validates that other household member ages are greater than 1" do lettings_log.age2 = 0 shared_validator.validate_numeric_min_max(lettings_log) expect(lettings_log.errors["age2"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Person 2’s age", min: 1, max: 120)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Person 2’s age", min: 1, max: 120)) end it "validates that person 1's age is less than 121" do lettings_log.age1 = 121 shared_validator.validate_numeric_min_max(lettings_log) expect(lettings_log.errors["age1"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)) end it "validates that other household member ages are greater than 121" do lettings_log.age2 = 123 shared_validator.validate_numeric_min_max(lettings_log) expect(lettings_log.errors["age2"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Person 2’s age", min: 1, max: 120)) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Person 2’s age", min: 1, max: 120)) end it "validates that person 1's age is between 16 and 120" do @@ -91,7 +91,7 @@ RSpec.describe Validations::SharedValidations do sales_log.savings = -10 sales_log.jointpur = 1 shared_validator.validate_numeric_min_max(sales_log) - expect(sales_log.errors["savings"]).to include(match I18n.t("validations.numeric.above_min", field: "Buyers’ total savings before any deposit paid", min: "£0")) + expect(sales_log.errors["savings"]).to include(match I18n.t("validations.shared.numeric.above_min", field: "Buyers’ total savings before any deposit paid", min: "£0")) end context "when validating percent" do @@ -101,7 +101,7 @@ RSpec.describe Validations::SharedValidations do sales_log.stairbought = 150 shared_validator.validate_numeric_min_max(sales_log) expect(sales_log.errors["stairbought"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Percentage bought in this staircasing transaction", min: "0%", max: "100%")) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Percentage bought in this staircasing transaction", min: "0%", max: "100%")) end end @@ -110,7 +110,7 @@ RSpec.describe Validations::SharedValidations do sales_log.income1 = -5 shared_validator.validate_numeric_min_max(sales_log) expect(sales_log.errors["income1"]) - .to include(match I18n.t("validations.numeric.within_range", field: "Buyer 1’s gross annual income", min: "£0", max: "£999,999")) + .to include(match I18n.t("validations.shared.numeric.within_range", field: "Buyer 1’s gross annual income", min: "£0", max: "£999,999")) end end end @@ -120,13 +120,13 @@ RSpec.describe Validations::SharedValidations do it "adds an error if input is a decimal" do sales_log.income1 = 30_000.5 shared_validator.validate_numeric_step(sales_log) - expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.whole_number", field: "Buyer 1’s gross annual income") + expect(sales_log.errors[:income1]).to include I18n.t("validations.shared.numeric.whole_number", field: "Buyer 1’s gross annual income") end it "adds an error if the user attempts to input a number in exponent format" do sales_log.income1 = "3e5" shared_validator.validate_numeric_step(sales_log) - expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.whole_number", field: "Buyer 1’s gross annual income") + expect(sales_log.errors[:income1]).to include I18n.t("validations.shared.numeric.whole_number", field: "Buyer 1’s gross annual income") end it "does not add an error if input is an integer" do @@ -141,14 +141,14 @@ RSpec.describe Validations::SharedValidations do sales_log.savings = 30_005 sales_log.jointpur = 1 shared_validator.validate_numeric_step(sales_log) - expect(sales_log.errors[:savings]).to include I18n.t("validations.numeric.nearest_ten", field: "Buyers’ total savings before any deposit paid") + expect(sales_log.errors[:savings]).to include I18n.t("validations.shared.numeric.nearest_ten", field: "Buyers’ total savings before any deposit paid") end it "adds an error if the user attempts to input a number in exponent format" do sales_log.savings = "3e5" sales_log.jointpur = 1 shared_validator.validate_numeric_step(sales_log) - expect(sales_log.errors[:savings]).to include I18n.t("validations.numeric.nearest_ten", field: "Buyers’ total savings before any deposit paid") + expect(sales_log.errors[:savings]).to include I18n.t("validations.shared.numeric.nearest_ten", field: "Buyers’ total savings before any deposit paid") end it "does not add an error if input is a multiple of ten" do @@ -162,7 +162,7 @@ RSpec.describe Validations::SharedValidations do it "adds an error if input has more than 2 decimal places" do sales_log.mscharge = 30.7418 shared_validator.validate_numeric_step(sales_log) - expect(sales_log.errors[:mscharge]).to include I18n.t("validations.numeric.nearest_hundredth", field: "Monthly leasehold charges") + expect(sales_log.errors[:mscharge]).to include I18n.t("validations.shared.numeric.nearest_hundredth", field: "Monthly leasehold charges") end it "does not add an error if the user attempts to input a number in exponent format" do @@ -220,13 +220,13 @@ RSpec.describe Validations::SharedValidations do it "does not allow letters" do sales_log.income1 = "abc" shared_validator.validate_numeric_input(sales_log) - expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.format", field: "Buyer 1’s gross annual income") + expect(sales_log.errors[:income1]).to include I18n.t("validations.shared.numeric.format", field: "Buyer 1’s gross annual income") end it "does not allow special characters" do sales_log.income1 = "3%5" shared_validator.validate_numeric_input(sales_log) - expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.format", field: "Buyer 1’s gross annual income") + expect(sales_log.errors[:income1]).to include I18n.t("validations.shared.numeric.format", field: "Buyer 1’s gross annual income") end it "allows a digit" do @@ -244,7 +244,7 @@ RSpec.describe Validations::SharedValidations do it "does not allow decimal point in a wrong format" do sales_log.income1 = "300.09.78" shared_validator.validate_numeric_input(sales_log) - expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.format", field: "Buyer 1’s gross annual income") + expect(sales_log.errors[:income1]).to include I18n.t("validations.shared.numeric.format", field: "Buyer 1’s gross annual income") end end end diff --git a/spec/models/validations/tenancy_validations_spec.rb b/spec/models/validations/tenancy_validations_spec.rb index 751506c07..aa9ca8f6d 100644 --- a/spec/models/validations/tenancy_validations_spec.rb +++ b/spec/models/validations/tenancy_validations_spec.rb @@ -276,7 +276,7 @@ RSpec.describe Validations::TenancyValidations do describe "tenancy type validations" do let(:record) { FactoryBot.build(:lettings_log, :setup_completed) } - let(:field) { "validations.other_field_missing" } + let(:field) { "validations.shared.other_field_missing" } let(:main_field_label) { "tenancy type" } let(:other_field) { "tenancyother" } let(:other_field_label) { "other tenancy type" } @@ -299,7 +299,7 @@ RSpec.describe Validations::TenancyValidations do end context "when tenancy type is not other" do - let(:field) { "validations.other_field_not_required" } + let(:field) { "validations.shared.other_field_not_required" } it "validates that other tenancy type is not provided" do record.tenancy = 2 diff --git a/spec/requests/lettings_logs_controller_spec.rb b/spec/requests/lettings_logs_controller_spec.rb index 308b90c1e..3d2c27400 100644 --- a/spec/requests/lettings_logs_controller_spec.rb +++ b/spec/requests/lettings_logs_controller_spec.rb @@ -82,7 +82,7 @@ RSpec.describe LettingsLogsController, type: :request do it "validates lettings log parameters" do json_response = JSON.parse(response.body) expect(response).to have_http_status(:unprocessable_entity) - expect(json_response["errors"]).to match_array([["offered", [I18n.t("validations.numeric.within_range", field: "Times previously offered since becoming available", min: 0, max: 20)]], ["age1", [I18n.t("validations.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)]]]) + expect(json_response["errors"]).to match_array([["offered", [I18n.t("validations.shared.numeric.within_range", field: "Times previously offered since becoming available", min: 0, max: 20)]], ["age1", [I18n.t("validations.shared.numeric.within_range", field: "Lead tenant’s age", min: 16, max: 120)]]]) end end From 224e49825e561e188f12ee4ae32d111bed4b9bfb Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Mon, 11 Nov 2024 17:05:55 +0000 Subject: [PATCH 13/27] CLDC-3719: Move sale completion date question to start of setup section (#2750) * CLDC-3716: Allow 25/26 form use on dev, review, and staging environments * Remove empty line * CLDC-3719: Move sale completion date question to start of setup section * Fix test * Update test fixture csv order --- app/models/form/sales/subsections/setup.rb | 2 +- spec/fixtures/files/sales_logs_csv_export_codes_23.csv | 6 +++--- spec/fixtures/files/sales_logs_csv_export_codes_24.csv | 6 +++--- spec/fixtures/files/sales_logs_csv_export_labels_23.csv | 6 +++--- spec/fixtures/files/sales_logs_csv_export_labels_24.csv | 6 +++--- .../files/sales_logs_csv_export_non_support_labels_24.csv | 6 +++--- spec/models/form/sales/subsections/setup_spec.rb | 4 ++-- spec/models/form_spec.rb | 4 ---- 8 files changed, 18 insertions(+), 22 deletions(-) diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index de623e769..e5b5b3f84 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -7,10 +7,10 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection def pages @pages ||= [ + Form::Sales::Pages::SaleDate.new(nil, nil, self), Form::Sales::Pages::OwningOrganisation.new(nil, nil, self), Form::Sales::Pages::ManagingOrganisation.new(nil, nil, self), Form::Sales::Pages::CreatedBy.new(nil, nil, self), - Form::Sales::Pages::SaleDate.new(nil, nil, self), Form::Sales::Pages::PurchaserCode.new(nil, nil, self), Form::Sales::Pages::OwnershipScheme.new(nil, nil, self), Form::Sales::Pages::SharedOwnershipType.new(nil, nil, self), diff --git a/spec/fixtures/files/sales_logs_csv_export_codes_23.csv b/spec/fixtures/files/sales_logs_csv_export_codes_23.csv index 198f89e20..68d7de56b 100644 --- a/spec/fixtures/files/sales_logs_csv_export_codes_23.csv +++ b/spec/fixtures/files/sales_logs_csv_export_codes_23.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,The ID on the old service,Year collection period opened,Was the log submitted in-service or via bulk upload?,Is the user in the created_by column the data protection officer?,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,Day of sale completion date,Month of sale completion date,Year of sale completion date,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,What is the UPRN of the property?,We found an address that might be this property. Is this the property address?,Address line 1,Address line 2,Town/City,County,Part 1 of the property's postcode,Part 2 of the property's postcode,LA code,LA name,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" -ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,1,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,2,8,,,,1,1,2,1,1,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,1,2,1,30,X,17,17,18,1,1,P,35,X,17,,13,1,1,3,C,14,X,,X,-9,X,3,R,-9,R,10,,,,,1,1,,,0,,,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 +Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,The ID on the old service,Year collection period opened,Was the log submitted in-service or via bulk upload?,Is the user in the created_by column the data protection officer?,Day of sale completion date,Month of sale completion date,Year of sale completion date,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,What is the UPRN of the property?,We found an address that might be this property. Is this the property address?,Address line 1,Address line 2,Town/City,County,Part 1 of the property's postcode,Part 2 of the property's postcode,LA code,LA name,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" +ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,DAY,MONTH,YEAR,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT +,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,1,false,8,12,2023,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,,2,8,,,,1,1,2,1,1,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,1,2,1,30,X,17,17,18,1,1,P,35,X,17,,13,1,1,3,C,14,X,,X,-9,X,3,R,-9,R,10,,,,,1,1,,,0,,,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_codes_24.csv b/spec/fixtures/files/sales_logs_csv_export_codes_24.csv index 6cacd2ef2..a93f0521f 100644 --- a/spec/fixtures/files/sales_logs_csv_export_codes_24.csv +++ b/spec/fixtures/files/sales_logs_csv_export_codes_24.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,Year collection period opened,Was the log submitted in-service or via bulk upload?,ID of a set of bulk uploaded logs,Is the user in the created_by column the data protection officer?,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,Day of sale completion date,Month of sale completion date,Year of sale completion date,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is the UPRN of the property?,Address line 1,Address line 2,Town/City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,LA name,LA code,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,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" -ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,1,,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,2,8,,,,1,1,2,1,1,"1, Test Street",,Test Town,,AA1 1AA,true,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,1,1,1,30,X,17,17,826,1,1,P,35,X,17,,826,1,1,3,C,14,X,9,X,-9,X,3,R,-9,R,10,,,,,1,0,SW1A,1AA,1,E09000033,Westminster,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 +Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,Year collection period opened,Was the log submitted in-service or via bulk upload?,ID of a set of bulk uploaded logs,Is the user in the created_by column the data protection officer?,Day of sale completion date,Month of sale completion date,Year of sale completion date,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is the UPRN of the property?,Address line 1,Address line 2,Town/City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,LA name,LA code,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,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" +ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,DAY,MONTH,YEAR,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT +,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,1,,false,1,5,2024,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,,2,8,,,,1,1,2,1,1,"1, Test Street",,Test Town,,AA1 1AA,true,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,1,1,1,30,X,17,17,826,1,1,P,35,X,17,,826,1,1,3,C,14,X,9,X,-9,X,3,R,-9,R,10,,,,,1,0,SW1A,1AA,1,E09000033,Westminster,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_labels_23.csv b/spec/fixtures/files/sales_logs_csv_export_labels_23.csv index 10850a9db..349ea54ea 100644 --- a/spec/fixtures/files/sales_logs_csv_export_labels_23.csv +++ b/spec/fixtures/files/sales_logs_csv_export_labels_23.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,The ID on the old service,Year collection period opened,Was the log submitted in-service or via bulk upload?,Is the user in the created_by column the data protection officer?,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,Day of sale completion date,Month of sale completion date,Year of sale completion date,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,What is the UPRN of the property?,We found an address that might be this property. Is this the property address?,Address line 1,Address line 2,Town/City,County,Part 1 of the property's postcode,Part 2 of the property's postcode,LA code,LA name,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" -ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,single log,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,Yes,Yes,1,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,Buyer prefers not to say,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,No,,,No,,,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 +Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,The ID on the old service,Year collection period opened,Was the log submitted in-service or via bulk upload?,Is the user in the created_by column the data protection officer?,Day of sale completion date,Month of sale completion date,Year of sale completion date,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,What is the UPRN of the property?,We found an address that might be this property. Is this the property address?,Address line 1,Address line 2,Town/City,County,Part 1 of the property's postcode,Part 2 of the property's postcode,LA code,LA name,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" +ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,DAY,MONTH,YEAR,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT +,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,single log,false,8,12,2023,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,Yes,Yes,1,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,Buyer prefers not to say,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,No,,,No,,,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_labels_24.csv b/spec/fixtures/files/sales_logs_csv_export_labels_24.csv index 3fc32f421..cd16ee79c 100644 --- a/spec/fixtures/files/sales_logs_csv_export_labels_24.csv +++ b/spec/fixtures/files/sales_logs_csv_export_labels_24.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,Year collection period opened,Was the log submitted in-service or via bulk upload?,ID of a set of bulk uploaded logs,Is the user in the created_by column the data protection officer?,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,Day of sale completion date,Month of sale completion date,Year of sale completion date,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,"What is the UPRN of the property?",Address line 1,Address line 2,Town/City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,LA name,LA code,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,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" -ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,"1, Test Street",,Test Town,,AA1 1AA,Yes,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 +Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,Year collection period opened,Was the log submitted in-service or via bulk upload?,ID of a set of bulk uploaded logs,Is the user in the created_by column the data protection officer?,Day of sale completion date,Month of sale completion date,Year of sale completion date,Which organisation owned this property before the sale?,Which organisation reported the sale?,User that created the log,User the log is assigned to,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,"What is the UPRN of the property?",Address line 1,Address line 2,Town/City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,LA name,LA code,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,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 1's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,Populated if a soft validation is confirmed.,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,Populated if a soft validation is confirmed.,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" +ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,DAY,MONTH,YEAR,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT +,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,1,5,2024,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,"1, Test Street",,Test Town,,AA1 1AA,Yes,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv b/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv index 8c5943c21..05e18a415 100644 --- a/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv +++ b/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,Year collection period opened,Was the log submitted in-service or via bulk upload?,,Is the user in the assigned_to column the data protection officer?,Which organisation owned this property before the sale?,Which organisation reported the sale?,User the log is assigned to,Day of sale completion date,Month of sale completion date,Year of sale completion date,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is the UPRN of the property?,We found an address that might be this property. Is this the property address?,Address line 1 input from address matching feature,Postcode input from address matching feature,UPRN of the address selected,Address line 1,Address line 2,Town/City,County,Part 1 of the property's postcode,Part 2 of the property's postcode,LA code,LA name,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 2's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" -id,status,duplicate_set_id,created_at,updated_at,collection_start_year,creation_method,bulk_upload_id,is_dpo,owning_organisation_name,managing_organisation_name,assigned_to,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,noint,privacynotice,uprn,uprn_confirmed,address_line1_input,postcode_full_input,uprn_selection,address_line1,address_line2,town_or_city,county,pcode1,pcode2,la,la_label,beds,proptype,builtype,wchair,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationality_all_buyer2,ecstat2,buy2livein,hholdcount,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,prevten,ppcodenk,ppostc1,ppostc2,previous_la_known,prevloc,prevloc_label,pregyrha,pregother,pregla,pregghb,pregblank,buy2living,prevtenbuy2,hhregres,hhregresstill,armedforcesspouse,disabled,wheel,income1nk,income1,inc1mort,income2nk,income2,inc2mort,hb,savingsnk,savings,prevown,prevshared,proplen,staircase,stairbought,stairowned,staircasesale,resale,exday,exmonth,exyear,hoday,homonth,hoyear,lanomagr,soctenant,frombeds,fromprop,socprevten,value,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,discount,grant -,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,MHCLG,MHCLG,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,Yes,Address line 1,SW1A 1AA,,"1, Test Street",,Test Town,,AA1,1AA,E09000033,Westminster,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,10000.0 +Log ID,Status of log,ID of a set of duplicate logs,Time and date the log was created,Time and date the log was last updated,Year collection period opened,Was the log submitted in-service or via bulk upload?,,Is the user in the assigned_to column the data protection officer?,Day of sale completion date,Month of sale completion date,Year of sale completion date,Which organisation owned this property before the sale?,Which organisation reported the sale?,User the log is assigned to,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership/discounted ownership/outright sale?,"If type = 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is the UPRN of the property?,We found an address that might be this property. Is this the property address?,Address line 1 input from address matching feature,Postcode input from address matching feature,UPRN of the address selected,Address line 1,Address line 2,Town/City,County,Part 1 of the property's postcode,Part 2 of the property's postcode,LA code,LA name,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,What is buyer 1's age?,Which of these best describes buyer 1's gender identity?,What is buyer 1's ethnic group?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,Which of these best describes buyer 1's working situation?,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,What is buyer 2's ethnic group?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,What is buyer 2 or person 2's working situation?,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,What is person 3's gender identity?,What is person 3's working situation?,What is person 4's relationship to buyer 1?,What is person 4's age?,What is person 4's gender identity?,What is person 4's working situation?,What is person 5's relationship to buyer 1?,What is person 5's age?,What is person 5's gender identity?,What is person 5's working situation?,What is person 6's relationship to buyer 1?,What is person 6's age?,What is person 6's gender identity?,What is person 6's working situation?,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,Do you know the local authority of buyer 1's last settled accommodation?,The local authority code of buyer 1's last settled accommodation,The local authority name of buyer 1's last settled accommodation,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"Populated if pregyrha, pregother, pregla and pregghb are blank","At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,Have any of the buyers ever served as a regular in the UK armed forces?,Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,Is buyer 1's annual income known?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,Is buyer 2's annual income known?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,Is the the total amount the buyers had in savings known?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,Day of the exchange of contracts,Month of the exchange of contracts,Year of the exchange of contracts,Day of the practical completion or handover date,Month of the practical completion or handover date,Year of the practical completion or handover date,Was the household rehoused under a local authority nominations agreement?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the rent type of buyer's previous tenure?,What is the full purchase price?,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If mortgagelender = 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social Homebuy?,What is the basic monthly rent?,Does the property have any monthly leasehold charges?,What are the total monthly leasehold charges for the property?,What was the percentage discount?,"What was the amount of any loan, grant, discount or subsidy given?" +id,status,duplicate_set_id,created_at,updated_at,collection_start_year,creation_method,bulk_upload_id,is_dpo,day,month,year,owning_organisation_name,managing_organisation_name,assigned_to,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,noint,privacynotice,uprn,uprn_confirmed,address_line1_input,postcode_full_input,uprn_selection,address_line1,address_line2,town_or_city,county,pcode1,pcode2,la,la_label,beds,proptype,builtype,wchair,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationality_all_buyer2,ecstat2,buy2livein,hholdcount,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,prevten,ppcodenk,ppostc1,ppostc2,previous_la_known,prevloc,prevloc_label,pregyrha,pregother,pregla,pregghb,pregblank,buy2living,prevtenbuy2,hhregres,hhregresstill,armedforcesspouse,disabled,wheel,income1nk,income1,inc1mort,income2nk,income2,inc2mort,hb,savingsnk,savings,prevown,prevshared,proplen,staircase,stairbought,stairowned,staircasesale,resale,exday,exmonth,exyear,hoday,homonth,hoyear,lanomagr,soctenant,frombeds,fromprop,socprevten,value,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,discount,grant +,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,1,5,2024,MHCLG,MHCLG,billyboy@eyeklaud.com,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,Yes,Address line 1,SW1A 1AA,,"1, Test Street",,Test Town,,AA1,1AA,E09000033,Westminster,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,10000.0 diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 70d52977f..1e49d11e6 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -28,10 +28,10 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do it "has correct pages" do expect(setup.pages.map(&:id)).to eq( %w[ + completion_date owning_organisation managing_organisation assigned_to - completion_date purchaser_code ownership_scheme shared_ownership_type @@ -54,10 +54,10 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do it "has correct pages" do expect(setup.pages.map(&:id)).to eq( %w[ + completion_date owning_organisation managing_organisation assigned_to - completion_date purchaser_code ownership_scheme shared_ownership_type diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index c51f71d3f..bb03cef59 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -387,10 +387,6 @@ RSpec.describe Form, type: :model do expect(form.sections[0].class).to eq(Form::Sales::Sections::Setup) expect(form.subsections.count).to eq(1) expect(form.subsections.first.id).to eq("setup") - expect(form.pages.count).to eq(13) - expect(form.pages.first.id).to eq("owning_organisation") - expect(form.questions.count).to eq(14) - expect(form.questions.first.id).to eq("owning_organisation_id") expect(form.start_date).to eq(Time.zone.parse("2022-04-01")) expect(form.new_logs_end_date).to eq(Time.zone.parse("2023-11-20")) expect(form.edit_end_date).to eq(Time.zone.parse("2023-11-20")) From afc7cf86b42cb9cd2a28d5efd931681b41f0b802 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:51:15 +0000 Subject: [PATCH 14/27] Exctract financial validations (#2740) --- app/models/lettings_log.rb | 6 - .../validations/financial_validations.rb | 126 ++++++++---------- config/locales/en.yml | 67 ---------- .../validations/lettings/financial.yml | 86 ++++++++++++ .../validations/financial_validations_spec.rb | 105 +++++++-------- 5 files changed, 190 insertions(+), 200 deletions(-) create mode 100644 config/locales/validations/lettings/financial.yml diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index d8732c3ea..d1ff6f738 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -508,12 +508,6 @@ class LettingsLog < Log hb == 10 end - # Option 7 has been removed starting from 22/23 - def receives_universal_credit_but_no_housing_benefit? - # 7: Universal Credit (without housing element) - hb == 7 - end - def receives_housing_related_benefits? if collection_start_year <= 2021 receives_housing_benefit_only? || receives_uc_with_housing_element_excl_housing_benefit? || diff --git a/app/models/validations/financial_validations.rb b/app/models/validations/financial_validations.rb index 724fa9b6e..19209f2d8 100644 --- a/app/models/validations/financial_validations.rb +++ b/app/models/validations/financial_validations.rb @@ -6,8 +6,8 @@ module Validations::FinancialValidations # or 'validate_' to run on submit as well def validate_outstanding_rent_amount(record) if !record.has_housing_benefit_rent_shortfall? && record.tshortfall.present? - record.errors.add :tshortfall, :no_outstanding_charges, message: I18n.t("validations.financial.tshortfall.outstanding_amount_not_expected") - record.errors.add :hbrentshortfall, :no_outstanding_charges, message: I18n.t("validations.financial.hbrentshortfall.outstanding_amount_not_expected") + record.errors.add :tshortfall, :no_outstanding_charges, message: I18n.t("validations.lettings.financial.tshortfall.outstanding_amount_not_expected") + record.errors.add :hbrentshortfall, :no_outstanding_charges, message: I18n.t("validations.lettings.financial.hbrentshortfall.outstanding_amount_not_expected") end end @@ -19,7 +19,7 @@ module Validations::FinancialValidations relationship = record["relat#{n}"] is_partner_or_main = relationship == "P" || (relationship.nil? && economic_status.present?) if is_employed && is_partner_or_main && record.benefits&.zero? - record.errors.add :benefits, I18n.t("validations.financial.benefits.part_or_full_time") + record.errors.add :benefits, I18n.t("validations.lettings.financial.benefits.part_or_full_time") end end end @@ -32,25 +32,25 @@ module Validations::FinancialValidations record.errors.add( :earnings, :over_hard_max, - message: I18n.t("validations.financial.earnings.over_hard_max", hard_max:), + message: I18n.t("validations.lettings.financial.earnings.over_hard_max", hard_max:), ) record.errors.add( :hhmemb, :over_hard_max, - message: I18n.t("validations.financial.hhmemb.earnings.over_hard_max", earnings: format_as_currency(record.earnings), frequency:), + message: I18n.t("validations.lettings.financial.hhmemb.earnings_over_hard_max", earnings: format_as_currency(record.earnings), frequency:), ) (1..record.hhmemb).each do |n| record.errors.add( "ecstat#{n}", :over_hard_max, - message: I18n.t("validations.financial.ecstat.over_hard_max", earnings: format_as_currency(record.earnings), frequency:), + message: I18n.t("validations.lettings.financial.ecstat.earnings_over_hard_max", earnings: format_as_currency(record.earnings), frequency:), ) next unless record["ecstat#{n}"] == 9 record.errors.add( "age#{n}", :over_hard_max, - message: I18n.t("validations.financial.age.earnings_over_hard_max", earnings: format_as_currency(record.earnings), frequency:), + message: I18n.t("validations.lettings.financial.age.earnings_over_hard_max", earnings: format_as_currency(record.earnings), frequency:), ) end end @@ -61,18 +61,18 @@ module Validations::FinancialValidations record.errors.add( :earnings, :under_hard_min, - message: I18n.t("validations.financial.earnings.under_hard_min", hard_min:), + message: I18n.t("validations.lettings.financial.earnings.under_hard_min", hard_min:), ) record.errors.add( :hhmemb, :under_hard_min, - message: I18n.t("validations.financial.hhmemb.earnings.under_hard_min", earnings: format_as_currency(record.earnings), frequency:), + message: I18n.t("validations.lettings.financial.hhmemb.earnings_under_hard_min", earnings: format_as_currency(record.earnings), frequency:), ) (1..record.hhmemb).each do |n| record.errors.add( "ecstat#{n}", :under_hard_min, - message: I18n.t("validations.financial.ecstat.under_hard_min", earnings: format_as_currency(record.earnings), frequency:), + message: I18n.t("validations.lettings.financial.ecstat.earnings_under_hard_min", earnings: format_as_currency(record.earnings), frequency:), ) # N.B. It is not possible for a change to an age field to increase the hard min end @@ -80,69 +80,61 @@ module Validations::FinancialValidations end if record.earnings.present? && record.incfreq.blank? - record.errors.add :incfreq, I18n.t("validations.financial.earnings.freq_missing") - record.errors.add :earnings, I18n.t("validations.financial.earnings.freq_missing") + record.errors.add :incfreq, I18n.t("validations.lettings.financial.incfreq.incfreq_missing") + record.errors.add :earnings, I18n.t("validations.lettings.financial.earnings.incfreq_missing") end if record.incfreq.present? && record.earnings.blank? - record.errors.add :earnings, I18n.t("validations.financial.earnings.earnings_missing") - record.errors.add :incfreq, I18n.t("validations.financial.earnings.earnings_missing") + record.errors.add :earnings, I18n.t("validations.lettings.financial.earnings.earnings_missing") + record.errors.add :incfreq, I18n.t("validations.lettings.financial.incfreq.earnings_missing") end end def validate_negative_currency(record) - t = %w[earnings brent scharge pscharge supcharg] - t.each do |x| - if record[x].present? && record[x].negative? - record.errors.add x.to_sym, I18n.t("validations.financial.negative_currency") + fields = %w[earnings brent scharge pscharge supcharg] + fields.each do |field| + if record[field].present? && record[field].negative? + record.errors.add field.to_sym, I18n.t("validations.lettings.financial.#{field}.negative_currency") end end end def validate_tshortfall(record) if record.has_housing_benefit_rent_shortfall? && no_known_benefits?(record) - record.errors.add :tshortfall, I18n.t("validations.financial.hbrentshortfall.outstanding_no_benefits") + record.errors.add :tshortfall, I18n.t("validations.lettings.financial.tshortfall.outstanding_no_benefits") end end def no_known_benefits?(record) return true unless record.collection_start_year - if record.collection_start_year <= 2021 - record.benefits_unknown? || - record.receives_no_benefits? || - record.receives_universal_credit_but_no_housing_benefit? - else - record.benefits_unknown? || - record.receives_no_benefits? || - record.tenant_refuses_to_say_benefits? - end + record.benefits_unknown? || record.receives_no_benefits? || record.tenant_refuses_to_say_benefits? end def validate_rent_amount(record) if record.wtshortfall if record.is_supported_housing? && record.wchchrg && (record.wtshortfall > record.wchchrg) - record.errors.add :tshortfall, message: I18n.t("validations.financial.tshortfall.more_than_carehome_charge") - record.errors.add :chcharge, I18n.t("validations.financial.carehome.less_than_shortfall") + record.errors.add :tshortfall, message: I18n.t("validations.lettings.financial.tshortfall.more_than_carehome_charge") + record.errors.add :chcharge, I18n.t("validations.lettings.financial.chcharge.less_than_shortfall") end if record.wtcharge && (record.wtshortfall > record.wtcharge) - record.errors.add :tshortfall, :more_than_rent, message: I18n.t("validations.financial.tshortfall.more_than_total_charge") - record.errors.add :tcharge, I18n.t("validations.financial.tcharge.less_than_shortfall") + record.errors.add :tshortfall, :more_than_rent, message: I18n.t("validations.lettings.financial.tshortfall.more_than_total_charge") + record.errors.add :tcharge, I18n.t("validations.lettings.financial.tcharge.less_than_shortfall") elsif record.wtshortfall < 0.01 - record.errors.add :tshortfall, :must_be_positive, message: I18n.t("validations.financial.tshortfall.must_be_positive") + record.errors.add :tshortfall, :must_be_positive, message: I18n.t("validations.lettings.financial.tshortfall.must_be_positive") end end if record.tcharge.present? && weekly_value_in_range(record, "tcharge", 0, 9.99) - record.errors.add :tcharge, :under_10, message: I18n.t("validations.financial.tcharge.under_10") + record.errors.add :tcharge, :under_10, message: I18n.t("validations.lettings.financial.tcharge.under_10") end answered_questions = [record.tcharge, record.chcharge].concat(record.household_charge && record.household_charge == 1 ? [record.household_charge] : []) if answered_questions.count(&:present?) > 1 - record.errors.add :tcharge, :complete_1_of_3, message: I18n.t("validations.financial.charges.complete_1_of_3") if record.tcharge.present? - record.errors.add :chcharge, I18n.t("validations.financial.charges.complete_1_of_3") if record.chcharge.present? - record.errors.add :household_charge, I18n.t("validations.financial.charges.complete_1_of_3") if record.household_charge.present? + record.errors.add :tcharge, :complete_1_of_3, message: I18n.t("validations.lettings.financial.tcharge.complete_1_of_3") if record.tcharge.present? + record.errors.add :chcharge, I18n.t("validations.lettings.financial.chcharge.complete_1_of_3") if record.chcharge.present? + record.errors.add :household_charge, I18n.t("validations.lettings.financial.household_charge.complete_1_of_3") if record.household_charge.present? end validate_charges(record) @@ -154,12 +146,12 @@ module Validations::FinancialValidations unless record.managing_organisation.rent_periods.include? record.period record.errors.add :period, :wrong_rent_period, message: I18n.t( - "validations.financial.rent_period.invalid_for_org.period", + "validations.lettings.financial.period.invalid_period_for_org", org_name: record.managing_organisation.name, rent_period: record.form.get_question("period", record).label_from_value(record.period).downcase, ) record.errors.add :managing_organisation_id, :skip_bu_error, message: I18n.t( - "validations.financial.rent_period.invalid_for_org.managing_org", + "validations.lettings.financial.managing_organisation_id.invalid_period_for_org", org_name: record.managing_organisation.name, rent_period: record.form.get_question("period", record).label_from_value(record.period).downcase, ) @@ -169,18 +161,12 @@ module Validations::FinancialValidations def validate_care_home_charges(record) if record.is_carehome? period = record.form.get_question("period", record).label_from_value(record.period).downcase - # NOTE: This is a temporary change to allow `ccharge` values despite `is_carehome` being true. This value - # is going to be moved to a soft validation in CLDC-2074, so we can safely do this. - if record.chcharge.blank? - # record.errors.add :is_carehome, I18n.t("validations.financial.carehome.not_provided", period:) - # record.errors.add :chcharge, I18n.t("validations.financial.carehome.not_provided", period:) - elsif !weekly_value_in_range(record, "chcharge", 10, 5000) + if record.chcharge.present? && !weekly_value_in_range(record, "chcharge", 10, 5000) max_chcharge = record.weekly_to_value_per_period(5000) min_chcharge = record.weekly_to_value_per_period(10) - message = I18n.t("validations.financial.carehome.out_of_range", period:, min_chcharge:, max_chcharge:) - record.errors.add :period, message - record.errors.add :chcharge, :out_of_range, message: + record.errors.add :period, I18n.t("validations.lettings.financial.period.chcharge_out_of_range", period:, min_chcharge:, max_chcharge:) + record.errors.add :chcharge, :out_of_range, message: I18n.t("validations.lettings.financial.chcharge.out_of_range", period:, min_chcharge:, max_chcharge:) end end end @@ -202,8 +188,8 @@ private provider_type_label = PROVIDER_TYPE[provider_type].to_s.humanize(capitalize: false) maximum_per_period = record.weekly_to_value_per_period(maximum_per_week) - record.errors.add charge, :outside_the_range, message: I18n.t("validations.financial.rent.out_of_range", charge_name:, maximum_per_period:, frequency:, letting_type:, provider_type: provider_type_label) - record.errors.add :period, :outside_the_range, message: I18n.t("validations.financial.rent.out_of_range", charge_name:, maximum_per_period:, frequency:, letting_type:, provider_type: provider_type_label) + record.errors.add charge, :outside_the_range, message: I18n.t("validations.lettings.financial.#{charge}.rent_out_of_range", charge_name:, maximum_per_period:, frequency:, letting_type:, provider_type: provider_type_label) + record.errors.add :period, :outside_the_range, message: I18n.t("validations.lettings.financial.period.rent_out_of_range", charge_name:, maximum_per_period:, frequency:, letting_type:, provider_type: provider_type_label) end end @@ -225,29 +211,29 @@ private if rent_range.present? && !weekly_value_in_range(record, "brent", rent_range.hard_min, rent_range.hard_max) && record.brent.present? && record.period.present? if record.weekly_value(record["brent"]) < rent_range.hard_min - record.errors.add :brent, :below_hard_min, message: I18n.t("validations.financial.brent.below_hard_min") - record.errors.add :beds, I18n.t("validations.financial.brent.beds.below_hard_min") - record.errors.add :uprn, I18n.t("validations.financial.brent.uprn.below_hard_min") - record.errors.add :la, I18n.t("validations.financial.brent.la.below_hard_min") - record.errors.add :postcode_known, I18n.t("validations.financial.brent.postcode_known.below_hard_min") - record.errors.add :scheme_id, I18n.t("validations.financial.brent.scheme_id.below_hard_min") - record.errors.add :location_id, I18n.t("validations.financial.brent.location_id.below_hard_min") - record.errors.add :rent_type, I18n.t("validations.financial.brent.rent_type.below_hard_min") - record.errors.add :needstype, I18n.t("validations.financial.brent.needstype.below_hard_min") - record.errors.add :period, I18n.t("validations.financial.brent.period.below_hard_min") + record.errors.add :brent, :below_hard_min, message: I18n.t("validations.lettings.financial.brent.below_hard_min") + record.errors.add :beds, I18n.t("validations.lettings.financial.beds.rent_below_hard_min") + record.errors.add :uprn, I18n.t("validations.lettings.financial.uprn.rent_below_hard_min") + record.errors.add :la, I18n.t("validations.lettings.financial.la.rent_below_hard_min") + record.errors.add :postcode_known, I18n.t("validations.lettings.financial.postcode_known.rent_below_hard_min") + record.errors.add :scheme_id, I18n.t("validations.lettings.financial.scheme_id.rent_below_hard_min") + record.errors.add :location_id, I18n.t("validations.lettings.financial.location_id.rent_below_hard_min") + record.errors.add :rent_type, I18n.t("validations.lettings.financial.rent_type.rent_below_hard_min") + record.errors.add :needstype, I18n.t("validations.lettings.financial.needstype.rent_below_hard_min") + record.errors.add :period, I18n.t("validations.lettings.financial.period.rent_below_hard_min") end if record.weekly_value(record["brent"]) > rent_range.hard_max - record.errors.add :brent, :over_hard_max, message: I18n.t("validations.financial.brent.above_hard_max") - record.errors.add :beds, I18n.t("validations.financial.brent.beds.above_hard_max") - record.errors.add :uprn, I18n.t("validations.financial.brent.uprn.above_hard_max") - record.errors.add :la, I18n.t("validations.financial.brent.la.above_hard_max") - record.errors.add :postcode_known, I18n.t("validations.financial.brent.postcode_known.above_hard_max") - record.errors.add :scheme_id, I18n.t("validations.financial.brent.scheme_id.above_hard_max") - record.errors.add :location_id, I18n.t("validations.financial.brent.location_id.above_hard_max") - record.errors.add :rent_type, I18n.t("validations.financial.brent.rent_type.above_hard_max") - record.errors.add :needstype, I18n.t("validations.financial.brent.needstype.above_hard_max") - record.errors.add :period, I18n.t("validations.financial.brent.period.above_hard_max") + record.errors.add :brent, :over_hard_max, message: I18n.t("validations.lettings.financial.brent.above_hard_max") + record.errors.add :beds, I18n.t("validations.lettings.financial.beds.rent_above_hard_max") + record.errors.add :uprn, I18n.t("validations.lettings.financial.uprn.rent_above_hard_max") + record.errors.add :la, I18n.t("validations.lettings.financial.la.rent_above_hard_max") + record.errors.add :postcode_known, I18n.t("validations.lettings.financial.postcode_known.rent_above_hard_max") + record.errors.add :scheme_id, I18n.t("validations.lettings.financial.scheme_id.rent_above_hard_max") + record.errors.add :location_id, I18n.t("validations.lettings.financial.location_id.rent_above_hard_max") + record.errors.add :rent_type, I18n.t("validations.lettings.financial.rent_type.rent_above_hard_max") + record.errors.add :needstype, I18n.t("validations.lettings.financial.needstype.rent_above_hard_max") + record.errors.add :period, I18n.t("validations.lettings.financial.period.rent_above_hard_max") end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 4c601b353..8cf9634b5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -285,83 +285,16 @@ en: one_three_bedroom_single_tenant_shared: "A shared house with fewer than two tenants must have 1 to 3 bedrooms." financial: - tshortfall: - outstanding_amount_not_expected: "You cannot answer the outstanding amount question if you don’t have outstanding rent or charges." - more_than_total_charge: "Enter a value less than the total charge." - more_than_carehome_charge: "Enter a value less than the care home charge." - must_be_positive: "Enter a value over £0.01 as you told us there is an outstanding amount." - hbrentshortfall: - outstanding_amount_not_expected: "Answer must be ‘yes’ as you have answered the outstanding amount question." - outstanding_no_benefits: "Answer cannot be ‘yes’ to outstanding amount for basic rent or charges if tenant does not receive housing benefit or Universal Credit or you‘re not sure." - benefits: - part_or_full_time: "Answer cannot be ‘all’ for income from Universal Credit, state pensions or benefits if the tenant or their partner works part-time or full-time." - earnings: - over_hard_max: "The household’s income cannot be greater than %{hard_max} per week given the household’s working situation." - under_hard_min: "The household’s income cannot be less than %{hard_min} per week given the household’s working situation." - freq_missing: "Select how often the household receives income." - earnings_missing: "Enter how much income the household has in total." income: outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." child_has_income: "Child's income must be £0." - negative_currency: "Enter an amount above 0." - rent: - out_of_range: "Enter a value for the %{charge_name} between £0 and %{maximum_per_period} paid %{frequency}. %{maximum_per_period} is the max limit for rent and charges paid %{frequency} for %{letting_type} lettings owned by a %{provider_type}." - ecstat: - over_hard_max: "The household’s income of %{earnings} %{frequency} is too high given the household’s working situation." - under_hard_min: "The household’s income of %{earnings} %{frequency} is too low given the household’s working situation." - age: - earnings_over_hard_max: "The household’s income of %{earnings} %{frequency} is too high for the number of adults. Change either the household income or the age of the tenants." - hhmemb: - earnings: - over_hard_max: "The household’s income of %{earnings} %{frequency} is too high for this number of tenants. Change either the household income or number of tenants." - under_hard_min: "The household’s income of %{earnings} %{frequency} is too low for this number of tenants. Change either the household income or number of tenants." - brent: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms." - scheme_id: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period and local authority." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period and local authority." - location_id: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period and local authority." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period and local authority." - postcode_known: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period, local authority and number of bedrooms." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period, local authority and number of bedrooms." - uprn: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this UPRN." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this UPRN." - la: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this local authority." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this local authority." - beds: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this number of bedrooms." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this number of bedrooms." - needstype: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this lettings type." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this lettings type." - rent_type: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this lettings type." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this lettings type." - period: - below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this period." - above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this period." charges: - complete_1_of_3: "Answer either the ‘household rent and charges’ question or ‘is this accommodation a care home‘, or select ‘no’ for ‘does the household pay rent or charges for the accommodation?’" missing_charges: "Please enter the %{sentence_fragment}. If there is no %{sentence_fragment}, please enter '0'." - tcharge: - under_10: "Enter a total charge that is at least £10.00 per week." - less_than_shortfall: "The total charge must be more than the outstanding amount." - rent_period: - invalid_for_org: - period: "%{org_name} does not use %{rent_period} as a rent period. Choose another rent period, or a data coordinator can add rent periods to your organisation." - managing_org: "%{org_name} does not use %{rent_period} as a rent period. Set another rent period on this log, or a data coordinator can add rent periods to this organisation." carehome: - out_of_range: "Household rent and other charges must be between %{min_chcharge} and %{max_chcharge} if paying %{period}." not_provided: "Enter how much rent and other charges the household pays %{period}." - less_than_shortfall: "The care home charge must be more than the outstanding amount." cash_discount_invalid: "Cash discount must be £0 - £999,999." staircasing: percentage_bought_must_be_greater_than_percentage_owned: "Total percentage %{buyer_now_owns} must be more than percentage bought in this transaction." diff --git a/config/locales/validations/lettings/financial.yml b/config/locales/validations/lettings/financial.yml new file mode 100644 index 000000000..f77e23e17 --- /dev/null +++ b/config/locales/validations/lettings/financial.yml @@ -0,0 +1,86 @@ +en: + validations: + lettings: + financial: + tshortfall: + outstanding_amount_not_expected: "You cannot answer the outstanding amount question if you don’t have outstanding rent or charges." + more_than_total_charge: "Enter a value less than the total charge." + more_than_carehome_charge: "Enter a value less than the care home charge." + must_be_positive: "Enter a value over £0.01 as you told us there is an outstanding amount." + outstanding_no_benefits: "Answer cannot be ‘yes’ to outstanding amount for basic rent or charges if tenant does not receive housing benefit or Universal Credit or you‘re not sure." + hbrentshortfall: + outstanding_amount_not_expected: "Answer must be ‘yes’ as you have answered the outstanding amount question." + benefits: + part_or_full_time: "Answer cannot be ‘all’ for income from Universal Credit, state pensions or benefits if the tenant or their partner works part-time or full-time." + earnings: + over_hard_max: "The household’s income cannot be greater than %{hard_max} per week given the household’s working situation." + under_hard_min: "The household’s income cannot be less than %{hard_min} per week given the household’s working situation." + incfreq_missing: "Select how often the household receives income." + earnings_missing: "Enter how much income the household has in total." + negative_currency: "Enter an amount above 0." + hhmemb: + earnings_over_hard_max: "The household’s income of %{earnings} %{frequency} is too high for this number of tenants. Change either the household income or number of tenants." + earnings_under_hard_min: "The household’s income of %{earnings} %{frequency} is too low for this number of tenants. Change either the household income or number of tenants." + ecstat: + earnings_over_hard_max: "The household’s income of %{earnings} %{frequency} is too high given the household’s working situation." + earnings_under_hard_min: "The household’s income of %{earnings} %{frequency} is too low given the household’s working situation." + age: + earnings_over_hard_max: "The household’s income of %{earnings} %{frequency} is too high for the number of adults. Change either the household income or the age of the tenants." + incfreq: + incfreq_missing: "Select how often the household receives income." + earnings_missing: "Enter how much income the household has in total." + brent: + negative_currency: "Enter an amount above 0." + below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms." + above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms." + scharge: + negative_currency: "Enter an amount above 0." + rent_out_of_range: "Enter a value for the %{charge_name} between £0 and %{maximum_per_period} paid %{frequency}. %{maximum_per_period} is the max limit for rent and charges paid %{frequency} for %{letting_type} lettings owned by a %{provider_type}." + pscharge: + negative_currency: "Enter an amount above 0." + rent_out_of_range: "Enter a value for the %{charge_name} between £0 and %{maximum_per_period} paid %{frequency}. %{maximum_per_period} is the max limit for rent and charges paid %{frequency} for %{letting_type} lettings owned by a %{provider_type}." + supcharg: + negative_currency: "Enter an amount above 0." + rent_out_of_range: "Enter a value for the %{charge_name} between £0 and %{maximum_per_period} paid %{frequency}. %{maximum_per_period} is the max limit for rent and charges paid %{frequency} for %{letting_type} lettings owned by a %{provider_type}." + chcharge: + less_than_shortfall: "The care home charge must be more than the outstanding amount." + complete_1_of_3: "Answer either the ‘household rent and charges’ question or ‘is this accommodation a care home‘, or select ‘no’ for ‘does the household pay rent or charges for the accommodation?’" + out_of_range: "Household rent and other charges must be between %{min_chcharge} and %{max_chcharge} if paying %{period}." + tcharge: + under_10: "Enter a total charge that is at least £10.00 per week." + less_than_shortfall: "The total charge must be more than the outstanding amount." + complete_1_of_3: "Answer either the ‘household rent and charges’ question or ‘is this accommodation a care home‘, or select ‘no’ for ‘does the household pay rent or charges for the accommodation?’" + household_charge: + complete_1_of_3: "Answer either the ‘household rent and charges’ question or ‘is this accommodation a care home‘, or select ‘no’ for ‘does the household pay rent or charges for the accommodation?’" + period: + invalid_period_for_org: "%{org_name} does not use %{rent_period} as a rent period. Choose another rent period, or a data coordinator can add rent periods to your organisation." + chcharge_out_of_range: "Household rent and other charges must be between %{min_chcharge} and %{max_chcharge} if paying %{period}." + rent_out_of_range: "Enter a value for the %{charge_name} between £0 and %{maximum_per_period} paid %{frequency}. %{maximum_per_period} is the max limit for rent and charges paid %{frequency} for %{letting_type} lettings owned by a %{provider_type}." + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this period." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this period." + managing_organisation_id: + invalid_period_for_org: "%{org_name} does not use %{rent_period} as a rent period. Set another rent period on this log, or a data coordinator can add rent periods to this organisation." + beds: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this number of bedrooms." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this number of bedrooms." + uprn: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this UPRN." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this UPRN." + la: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this local authority." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this local authority." + postcode_known: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period, local authority and number of bedrooms." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period, local authority and number of bedrooms." + scheme_id: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period and local authority." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period and local authority." + location_id: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period and local authority." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period and local authority." + rent_type: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this lettings type." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this lettings type." + needstype: + rent_below_hard_min: "Rent is below the absolute minimum expected for a property of this type based on this lettings type." + rent_above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type based on this lettings type." diff --git a/spec/models/validations/financial_validations_spec.rb b/spec/models/validations/financial_validations_spec.rb index f35cdd097..a2d51f7f9 100644 --- a/spec/models/validations/financial_validations_spec.rb +++ b/spec/models/validations/financial_validations_spec.rb @@ -17,9 +17,9 @@ RSpec.describe Validations::FinancialValidations do record.incfreq = nil financial_validator.validate_net_income(record) expect(record.errors["incfreq"]) - .to include(match I18n.t("validations.financial.earnings.freq_missing")) + .to include(match I18n.t("validations.lettings.financial.incfreq.incfreq_missing")) expect(record.errors["earnings"]) - .to include(match I18n.t("validations.financial.earnings.freq_missing")) + .to include(match I18n.t("validations.lettings.financial.earnings.incfreq_missing")) end it "when income frequency is provided it validates that earnings must be provided" do @@ -27,9 +27,9 @@ RSpec.describe Validations::FinancialValidations do record.incfreq = 1 financial_validator.validate_net_income(record) expect(record.errors["earnings"]) - .to include(match I18n.t("validations.financial.earnings.earnings_missing")) + .to include(match I18n.t("validations.lettings.financial.earnings.earnings_missing")) expect(record.errors["incfreq"]) - .to include(match I18n.t("validations.financial.earnings.earnings_missing")) + .to include(match I18n.t("validations.lettings.financial.earnings.earnings_missing")) end end @@ -39,14 +39,14 @@ RSpec.describe Validations::FinancialValidations do record.benefits = 0 record.ecstat1 = 1 financial_validator.validate_net_income_uc_proportion(record) - expect(record.errors["benefits"]).to include(match I18n.t("validations.financial.benefits.part_or_full_time")) + expect(record.errors["benefits"]).to include(match I18n.t("validations.lettings.financial.benefits.part_or_full_time")) end it "validates that the lead tenant is not in part time employment" do record.benefits = 0 record.ecstat1 = 0 financial_validator.validate_net_income_uc_proportion(record) - expect(record.errors["benefits"]).to include(match I18n.t("validations.financial.benefits.part_or_full_time")) + expect(record.errors["benefits"]).to include(match I18n.t("validations.lettings.financial.benefits.part_or_full_time")) end it "expects that the lead tenant is not in full-time or part-time employment" do @@ -61,7 +61,7 @@ RSpec.describe Validations::FinancialValidations do record.ecstat2 = 0 record.relat2 = "P" financial_validator.validate_net_income_uc_proportion(record) - expect(record.errors["benefits"]).to include(match I18n.t("validations.financial.benefits.part_or_full_time")) + expect(record.errors["benefits"]).to include(match I18n.t("validations.lettings.financial.benefits.part_or_full_time")) end it "expects that the tenant’s partner is not in full-time or part-time employment" do @@ -81,7 +81,7 @@ RSpec.describe Validations::FinancialValidations do record.tshortfall = 99 financial_validator.validate_outstanding_rent_amount(record) expect(record.errors["tshortfall"]) - .to include(match I18n.t("validations.financial.tshortfall.outstanding_amount_not_expected")) + .to include(match I18n.t("validations.lettings.financial.tshortfall.outstanding_amount_not_expected")) end end @@ -104,7 +104,7 @@ RSpec.describe Validations::FinancialValidations do record.set_derived_fields! financial_validator.validate_rent_amount(record) expect(record.errors["tshortfall"]) - .to include(match I18n.t("validations.financial.tshortfall.must_be_positive")) + .to include(match I18n.t("validations.lettings.financial.tshortfall.must_be_positive")) end it "validates that total charge is no less than the shortfall" do @@ -118,9 +118,9 @@ RSpec.describe Validations::FinancialValidations do record.set_derived_fields! financial_validator.validate_rent_amount(record) expect(record.errors["tcharge"]) - .to include(match I18n.t("validations.financial.tcharge.less_than_shortfall")) + .to include(match I18n.t("validations.lettings.financial.tcharge.less_than_shortfall")) expect(record.errors["tshortfall"]) - .to include(match I18n.t("validations.financial.tshortfall.more_than_total_charge")) + .to include(match I18n.t("validations.lettings.financial.tshortfall.more_than_total_charge")) end it "validates that carehome charge is no less than the shortfall" do @@ -134,9 +134,9 @@ RSpec.describe Validations::FinancialValidations do record.set_derived_fields! financial_validator.validate_rent_amount(record) expect(record.errors["chcharge"]) - .to include(match I18n.t("validations.financial.carehome.less_than_shortfall")) + .to include(match I18n.t("validations.lettings.financial.chcharge.less_than_shortfall")) expect(record.errors["tshortfall"]) - .to include(match I18n.t("validations.financial.tshortfall.more_than_carehome_charge")) + .to include(match I18n.t("validations.lettings.financial.tshortfall.more_than_carehome_charge")) end it "expects that rent can be less than the shortfall if total charge is higher" do @@ -181,13 +181,13 @@ RSpec.describe Validations::FinancialValidations do financial_validator.validate_rent_period(record) expect(record.errors["period"]) .to include(match I18n.t( - "validations.financial.rent_period.invalid_for_org.period", + "validations.lettings.financial.period.invalid_period_for_org", org_name: user.organisation.name, rent_period: "every 4 weeks", )) expect(record.errors["managing_organisation_id"]) .to include(match I18n.t( - "validations.financial.rent_period.invalid_for_org.managing_org", + "validations.lettings.financial.managing_organisation_id.invalid_period_for_org", org_name: user.organisation.name, rent_period: "every 4 weeks", )) @@ -204,7 +204,7 @@ RSpec.describe Validations::FinancialValidations do record.hb = 9 financial_validator.validate_tshortfall(record) expect(record.errors["tshortfall"]) - .to include(match I18n.t("validations.financial.hbrentshortfall.outstanding_no_benefits")) + .to include(match I18n.t("validations.lettings.financial.tshortfall.outstanding_no_benefits")) end it "validates that housing benefit is not don't know" do @@ -212,16 +212,7 @@ RSpec.describe Validations::FinancialValidations do record.hb = 3 financial_validator.validate_tshortfall(record) expect(record.errors["tshortfall"]) - .to include(match I18n.t("validations.financial.hbrentshortfall.outstanding_no_benefits")) - end - - it "validates that housing benefit is not Universal Credit without housing benefit (prior to 22/23)" do - record.startdate = Time.zone.local(2022, 3, 1) - record.hbrentshortfall = 1 - record.hb = 7 - financial_validator.validate_tshortfall(record) - expect(record.errors["tshortfall"]) - .to include(match I18n.t("validations.financial.hbrentshortfall.outstanding_no_benefits")) + .to include(match I18n.t("validations.lettings.financial.tshortfall.outstanding_no_benefits")) end it "validates that housing benefit is provided" do @@ -375,15 +366,15 @@ RSpec.describe Validations::FinancialValidations do financial_validator.validate_negative_currency(record) expect(record.errors["earnings"]) - .to include(match I18n.t("validations.financial.negative_currency")) + .to include(match I18n.t("validations.lettings.financial.earnings.negative_currency")) expect(record.errors["brent"]) - .to include(match I18n.t("validations.financial.negative_currency")) + .to include(match I18n.t("validations.lettings.financial.brent.negative_currency")) expect(record.errors["scharge"]) - .to include(match I18n.t("validations.financial.negative_currency")) + .to include(match I18n.t("validations.lettings.financial.scharge.negative_currency")) expect(record.errors["pscharge"]) - .to include(match I18n.t("validations.financial.negative_currency")) + .to include(match I18n.t("validations.lettings.financial.pscharge.negative_currency")) expect(record.errors["supcharg"]) - .to include(match I18n.t("validations.financial.negative_currency")) + .to include(match I18n.t("validations.lettings.financial.supcharg.negative_currency")) end end @@ -466,7 +457,7 @@ RSpec.describe Validations::FinancialValidations do record[test_case[:charge][:field]] = test_case[:charge][:value] financial_validator.validate_rent_amount(record) expect(record.errors[test_case[:charge][:field]]) - .to include(match I18n.t("validations.financial.rent.out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "general needs", provider_type: "private registered provider")) + .to include(match I18n.t("validations.lettings.financial.#{test_case[:charge][:field]}.rent_out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "general needs", provider_type: "private registered provider")) end end @@ -578,7 +569,7 @@ RSpec.describe Validations::FinancialValidations do record[test_case[:charge][:field]] = test_case[:charge][:value] financial_validator.validate_rent_amount(record) expect(record.errors[test_case[:charge][:field]]) - .to include(match I18n.t("validations.financial.rent.out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "supported housing", provider_type: "private registered provider")) + .to include(match I18n.t("validations.lettings.financial.#{test_case[:charge][:field]}.rent_out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "supported housing", provider_type: "private registered provider")) end end @@ -694,7 +685,7 @@ RSpec.describe Validations::FinancialValidations do record[test_case[:charge][:field]] = test_case[:charge][:value] financial_validator.validate_rent_amount(record) expect(record.errors[test_case[:charge][:field]]) - .to include(match I18n.t("validations.financial.rent.out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "general needs", provider_type: "local authority")) + .to include(match I18n.t("validations.lettings.financial.#{test_case[:charge][:field]}.rent_out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "general needs", provider_type: "local authority")) end end @@ -806,7 +797,7 @@ RSpec.describe Validations::FinancialValidations do record[test_case[:charge][:field]] = test_case[:charge][:value] financial_validator.validate_rent_amount(record) expect(record.errors[test_case[:charge][:field]]) - .to include(match I18n.t("validations.financial.rent.out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "supported housing", provider_type: "local authority")) + .to include(match I18n.t("validations.lettings.financial.#{test_case[:charge][:field]}.rent_out_of_range", charge_name: test_case[:charge_name], maximum_per_period: test_case[:maximum_per_period], frequency: test_case[:period][:label], letting_type: "supported housing", provider_type: "local authority")) end end @@ -885,7 +876,7 @@ RSpec.describe Validations::FinancialValidations do record.tcharge = 9 financial_validator.validate_rent_amount(record) expect(record.errors["tcharge"]) - .to include(match I18n.t("validations.financial.tcharge.under_10")) + .to include(match I18n.t("validations.lettings.financial.tcharge.under_10")) end it "allows the total charge to be over 10 per week" do @@ -903,7 +894,7 @@ RSpec.describe Validations::FinancialValidations do record.tcharge = 19.99 financial_validator.validate_rent_amount(record) expect(record.errors["tcharge"]) - .to include(match I18n.t("validations.financial.tcharge.under_10")) + .to include(match I18n.t("validations.lettings.financial.tcharge.under_10")) end it "allows the total charge to be over 10 per week" do @@ -922,11 +913,11 @@ RSpec.describe Validations::FinancialValidations do record.household_charge = 1 financial_validator.validate_rent_amount(record) expect(record.errors["tcharge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.tcharge.complete_1_of_3")) expect(record.errors["chcharge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.chcharge.complete_1_of_3")) expect(record.errors["household_charge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.household_charge.complete_1_of_3")) end it "returns an error for tcharge and chcharge types selected" do @@ -936,9 +927,9 @@ RSpec.describe Validations::FinancialValidations do expect(record.errors["household_charge"]) .to be_empty expect(record.errors["tcharge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.tcharge.complete_1_of_3")) expect(record.errors["chcharge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.chcharge.complete_1_of_3")) end it "returns an error for tcharge type and household_charge not paid selected" do @@ -948,9 +939,9 @@ RSpec.describe Validations::FinancialValidations do expect(record.errors["chcharge"]) .to be_empty expect(record.errors["tcharge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.tcharge.complete_1_of_3")) expect(record.errors["household_charge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.household_charge.complete_1_of_3")) end it "returns an error for chcharge type and household_charge not paid selected" do @@ -960,9 +951,9 @@ RSpec.describe Validations::FinancialValidations do expect(record.errors["tcharge"]) .to be_empty expect(record.errors["chcharge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.chcharge.complete_1_of_3")) expect(record.errors["household_charge"]) - .to include(match I18n.t("validations.financial.charges.complete_1_of_3")) + .to include(match I18n.t("validations.lettings.financial.household_charge.complete_1_of_3")) end end @@ -1038,7 +1029,7 @@ RSpec.describe Validations::FinancialValidations do financial_validator.validate_rent_amount(record) expect(record.errors["brent"]) - .to include(match I18n.t("validations.financial.brent.below_hard_min")) + .to include(match I18n.t("validations.lettings.financial.brent.below_hard_min")) end it "validates hard minimum for supported housing" do @@ -1051,11 +1042,11 @@ RSpec.describe Validations::FinancialValidations do financial_validator.validate_rent_amount(record) expect(record.errors["brent"]) - .to include(match I18n.t("validations.financial.brent.below_hard_min")) + .to include(match I18n.t("validations.lettings.financial.brent.below_hard_min")) %w[beds la postcode_known scheme_id location_id rent_type needstype period].each do |field| expect(record.errors[field]) - .to include(match I18n.t("validations.financial.brent.#{field}.below_hard_min")) + .to include(match I18n.t("validations.lettings.financial.#{field}.rent_below_hard_min")) end end @@ -1070,11 +1061,11 @@ RSpec.describe Validations::FinancialValidations do financial_validator.validate_rent_amount(record) expect(record.errors["brent"]) - .to include(match I18n.t("validations.financial.brent.above_hard_max")) + .to include(match I18n.t("validations.lettings.financial.brent.above_hard_max")) %w[beds la postcode_known scheme_id location_id rent_type needstype period].each do |field| expect(record.errors[field]) - .to include(match I18n.t("validations.financial.brent.#{field}.above_hard_max")) + .to include(match I18n.t("validations.lettings.financial.#{field}.rent_above_hard_max")) end end @@ -1088,11 +1079,11 @@ RSpec.describe Validations::FinancialValidations do financial_validator.validate_rent_amount(record) expect(record.errors["brent"]) - .to include(match I18n.t("validations.financial.brent.above_hard_max")) + .to include(match I18n.t("validations.lettings.financial.brent.above_hard_max")) %w[beds la postcode_known scheme_id location_id rent_type needstype period].each do |field| expect(record.errors[field]) - .to include(match I18n.t("validations.financial.brent.#{field}.above_hard_max")) + .to include(match I18n.t("validations.lettings.financial.#{field}.rent_above_hard_max")) end end @@ -1106,11 +1097,11 @@ RSpec.describe Validations::FinancialValidations do financial_validator.validate_rent_amount(record) expect(record.errors["brent"]) - .to include(match I18n.t("validations.financial.brent.above_hard_max")) + .to include(match I18n.t("validations.lettings.financial.brent.above_hard_max")) %w[beds la postcode_known scheme_id location_id rent_type needstype period].each do |field| expect(record.errors[field]) - .to include(match I18n.t("validations.financial.brent.#{field}.above_hard_max")) + .to include(match I18n.t("validations.lettings.financial.#{field}.rent_above_hard_max")) end end @@ -1213,9 +1204,9 @@ RSpec.describe Validations::FinancialValidations do record.chcharge = nil financial_validator.validate_care_home_charges(record) expect(record.errors["chcharge"]) - .to include(match I18n.t("validations.financial.carehome.not_provided", period: "every 4 weeks")) + .to include(match I18n.t("validations.lettings.financial.carehome.not_provided", period: "every 4 weeks")) expect(record.errors["is_carehome"]) - .to include(match I18n.t("validations.financial.carehome.not_provided", period: "every 4 weeks")) + .to include(match I18n.t("validations.lettings.financial.carehome.not_provided", period: "every 4 weeks")) end end From b681b101f3b494409c19722088a4bcb9c9c4766e Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:39:53 +0000 Subject: [PATCH 15/27] CLDC-3715: Sales - Remove Q8 (What is the type of outright sale?) (25/26) (#2753) --- app/models/form/sales/subsections/setup.rb | 2 +- config/locales/forms/2025/sales/setup.en.yml | 10 ------ .../form/sales/subsections/setup_spec.rb | 34 ++++++++++++++++++- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index e5b5b3f84..b0c7025c7 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -15,7 +15,7 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection Form::Sales::Pages::OwnershipScheme.new(nil, nil, self), Form::Sales::Pages::SharedOwnershipType.new(nil, nil, self), Form::Sales::Pages::DiscountedOwnershipType.new(nil, nil, self), - Form::Sales::Pages::OutrightOwnershipType.new(nil, nil, self), + (Form::Sales::Pages::OutrightOwnershipType.new(nil, nil, self) unless form.start_year_2025_or_later?), Form::Sales::Pages::BuyerCompany.new(nil, nil, self), Form::Sales::Pages::BuyerLive.new(nil, nil, self), Form::Sales::Pages::JointPurchase.new(nil, nil, self), diff --git a/config/locales/forms/2025/sales/setup.en.yml b/config/locales/forms/2025/sales/setup.en.yml index 4f00ab0c2..105d0ad0d 100644 --- a/config/locales/forms/2025/sales/setup.en.yml +++ b/config/locales/forms/2025/sales/setup.en.yml @@ -50,16 +50,6 @@ en: check_answer_label: "Type of discounted ownership sale" hint_text: "" question_text: "What is the type of discounted ownership sale?" - outright_ownership: - page_header: "Type of outright sale" - type: - check_answer_label: "Type of outright sale" - hint_text: "" - question_text: "What is the type of outright sale?" - othtype: - check_answer_label: "Type of other sale" - hint_text: "" - question_text: "What type of sale is it?" companybuy: page_header: "" diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 1e49d11e6..1cd363105 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -23,6 +23,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do context "when start year is before 2024" do before do allow(section.form).to receive(:start_year_2024_or_later?).and_return(false) + allow(section.form).to receive(:start_year_2025_or_later?).and_return(false) end it "has correct pages" do @@ -46,9 +47,10 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do end end - context "when start year is >= 2024" do + context "when start year is 2024" do before do allow(section.form).to receive(:start_year_2024_or_later?).and_return(true) + allow(section.form).to receive(:start_year_2025_or_later?).and_return(false) end it "has correct pages" do @@ -75,4 +77,34 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do ) end end + + context "when start year is >= 2025" do + before do + allow(section.form).to receive(:start_year_2024_or_later?).and_return(true) + allow(section.form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has correct pages" do + expect(setup.pages.map(&:id)).to eq( + %w[ + completion_date + owning_organisation + managing_organisation + assigned_to + purchaser_code + ownership_scheme + shared_ownership_type + discounted_ownership_type + buyer_company + buyer_live + joint_purchase + number_joint_buyers + buyer_interview_joint_purchase + buyer_interview + privacy_notice_joint_purchase + privacy_notice + ], + ) + end + end end From 6fe2a5b6cd28803db9cd84458024a41721b7accd Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 12 Nov 2024 17:50:31 +0000 Subject: [PATCH 16/27] Handle flaky failing tests, change scheme factory service name (#2768) --- spec/factories/scheme.rb | 2 +- spec/requests/locations_controller_spec.rb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/factories/scheme.rb b/spec/factories/scheme.rb index 5f4ad30bc..77d74b70a 100644 --- a/spec/factories/scheme.rb +++ b/spec/factories/scheme.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :scheme do - service_name { Faker::Name.name } + service_name { "#{Faker::Name.name}'s Housing & Co." } sensitive { Faker::Number.within(range: 0..1) } registered_under_care_act { 1 } support_type { [0, 2, 3, 4, 5].sample } diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index a7d7684f0..6de8e7d33 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -180,7 +180,7 @@ RSpec.describe LocationsController, type: :request do context "when signed in as a data coordinator user" do let(:user) { create(:user, :data_coordinator) } - let(:scheme) { create(:scheme, owning_organisation: user.organisation, service_name: "Some name") } + let(:scheme) { create(:scheme, owning_organisation: user.organisation) } let!(:locations) { create_list(:location, 3, scheme:, startdate: Time.zone.local(2022, 4, 1)) } before do @@ -215,7 +215,7 @@ RSpec.describe LocationsController, type: :request do end it "has correct title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title(expected_title) end @@ -232,7 +232,7 @@ RSpec.describe LocationsController, type: :request do end it "has correct page 1 of 2 title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title(expected_title) end @@ -254,7 +254,7 @@ RSpec.describe LocationsController, type: :request do end it "has correct page 2 of 2 title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title(expected_title) end @@ -287,7 +287,7 @@ RSpec.describe LocationsController, type: :request do end it "has search in the title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} (1 location matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} (1 location matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page.title).to eq(expected_title) end end @@ -343,7 +343,7 @@ RSpec.describe LocationsController, type: :request do end it "has correct title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title(expected_title) end @@ -360,7 +360,7 @@ RSpec.describe LocationsController, type: :request do end it "has correct page 1 of 2 title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title(expected_title) end @@ -382,7 +382,7 @@ RSpec.describe LocationsController, type: :request do end it "has correct page 1 of 2 title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title(expected_title) end @@ -415,7 +415,7 @@ RSpec.describe LocationsController, type: :request do end it "has search in the title" do - expected_title = CGI.escapeHTML("#{scheme.service_name} (1 location matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expected_title = CGI.unescapeHTML("#{scheme.service_name} (1 location matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title(expected_title) end end From f77a986e132d74559aa3c49b1f46f07cb862728c Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:50:49 +0000 Subject: [PATCH 17/27] Do not save bu log when setting creation method (#2770) --- app/services/bulk_upload/lettings/log_creator.rb | 2 +- app/services/bulk_upload/sales/log_creator.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/bulk_upload/lettings/log_creator.rb b/app/services/bulk_upload/lettings/log_creator.rb index 3aaf1d69d..1fd0d45b6 100644 --- a/app/services/bulk_upload/lettings/log_creator.rb +++ b/app/services/bulk_upload/lettings/log_creator.rb @@ -15,7 +15,7 @@ class BulkUpload::Lettings::LogCreator row_parser.log.blank_invalid_non_setup_fields! row_parser.log.bulk_upload = bulk_upload - row_parser.log.creation_method_bulk_upload! + row_parser.log.creation_method = "bulk upload" row_parser.log.skip_update_status = true row_parser.log.status = "pending" row_parser.log.status_cache = row_parser.log.calculate_status diff --git a/app/services/bulk_upload/sales/log_creator.rb b/app/services/bulk_upload/sales/log_creator.rb index 2d0888e4d..ea337d220 100644 --- a/app/services/bulk_upload/sales/log_creator.rb +++ b/app/services/bulk_upload/sales/log_creator.rb @@ -14,7 +14,7 @@ class BulkUpload::Sales::LogCreator row_parser.log.blank_invalid_non_setup_fields! row_parser.log.bulk_upload = bulk_upload - row_parser.log.creation_method_bulk_upload! + row_parser.log.creation_method = "bulk upload" row_parser.log.skip_update_status = true row_parser.log.status = "pending" row_parser.log.status_cache = row_parser.log.calculate_status From 30442fcee27e13d59817dc75b675a89fdac5500e Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:42:05 +0000 Subject: [PATCH 18/27] CLDC-3735: Sales - Move Q19 (What type of unit is the property?) (25/26) (#2760) --- .../derived_variables/sales_log_variables.rb | 4 +++ .../pages/property_number_of_bedrooms.rb | 1 + .../sales/subsections/property_information.rb | 3 +- app/models/sales_log.rb | 4 +++ .../2025/sales/property_information.en.yml | 2 +- .../subsections/property_information_spec.rb | 36 +++++++++++++++++++ 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/app/models/derived_variables/sales_log_variables.rb b/app/models/derived_variables/sales_log_variables.rb index e182c2158..a1462454c 100644 --- a/app/models/derived_variables/sales_log_variables.rb +++ b/app/models/derived_variables/sales_log_variables.rb @@ -68,6 +68,10 @@ module DerivedVariables::SalesLogVariables self.la = nil end + if form.start_year_2025_or_later? && is_bedsit? + self.beds = 1 + end + self.nationality_all = nationality_all_group if nationality_uk_or_prefers_not_to_say? self.nationality_all_buyer2 = nationality_all_buyer2_group if nationality2_uk_or_prefers_not_to_say? diff --git a/app/models/form/sales/pages/property_number_of_bedrooms.rb b/app/models/form/sales/pages/property_number_of_bedrooms.rb index 796a617d5..a51cbfeca 100644 --- a/app/models/form/sales/pages/property_number_of_bedrooms.rb +++ b/app/models/form/sales/pages/property_number_of_bedrooms.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::PropertyNumberOfBedrooms < ::Form::Page def initialize(id, hsh, subsection) super @id = "property_number_of_bedrooms" + @depends_on = [{ "is_beds_inferred?" => false }] end def questions diff --git a/app/models/form/sales/subsections/property_information.rb b/app/models/form/sales/subsections/property_information.rb index 32df98af5..5d4021681 100644 --- a/app/models/form/sales/subsections/property_information.rb +++ b/app/models/form/sales/subsections/property_information.rb @@ -9,9 +9,10 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection def pages @pages ||= [ (uprn_questions if form.start_date.year >= 2024), + (Form::Sales::Pages::PropertyUnitType.new(nil, nil, self) if form.start_year_2025_or_later?), Form::Sales::Pages::PropertyNumberOfBedrooms.new(nil, nil, self), Form::Sales::Pages::AboutPriceValueCheck.new("about_price_bedrooms_value_check", nil, self), - Form::Sales::Pages::PropertyUnitType.new(nil, nil, self), + (Form::Sales::Pages::PropertyUnitType.new(nil, nil, self) unless form.start_year_2025_or_later?), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_property_type_value_check", nil, self), Form::Sales::Pages::PercentageDiscountValueCheck.new("percentage_discount_proptype_value_check", nil, self), Form::Sales::Pages::PropertyBuildingType.new(nil, nil, self), diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 23438142f..01741fbc5 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -396,6 +396,10 @@ class SalesLog < Log proptype == 2 end + def is_beds_inferred? + form.start_year_2025_or_later? && is_bedsit? + end + def shared_ownership_scheme? ownershipsch == 1 end diff --git a/config/locales/forms/2025/sales/property_information.en.yml b/config/locales/forms/2025/sales/property_information.en.yml index 240c96f09..d658362ea 100644 --- a/config/locales/forms/2025/sales/property_information.en.yml +++ b/config/locales/forms/2025/sales/property_information.en.yml @@ -69,7 +69,7 @@ en: beds: page_header: "" check_answer_label: "Number of bedrooms" - hint_text: "A bedsit has 1 bedroom." + hint_text: "" question_text: "How many bedrooms does the property have?" proptype: diff --git a/spec/models/form/sales/subsections/property_information_spec.rb b/spec/models/form/sales/subsections/property_information_spec.rb index d29ee85fe..ccfeb8e3a 100644 --- a/spec/models/form/sales/subsections/property_information_spec.rb +++ b/spec/models/form/sales/subsections/property_information_spec.rb @@ -15,6 +15,7 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do before do allow(form).to receive(:start_year_2024_or_later?).and_return(false) + allow(form).to receive(:start_year_2025_or_later?).and_return(false) end context "when 2023" do @@ -48,6 +49,7 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do before do allow(form).to receive(:start_year_2024_or_later?).and_return(true) + allow(form).to receive(:start_year_2025_or_later?).and_return(false) end it "has correct pages" do @@ -75,6 +77,40 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do ) end end + + context "when 2025" do + let(:start_date) { Time.utc(2025, 2, 8) } + + before do + allow(form).to receive(:start_year_2024_or_later?).and_return(true) + allow(form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has correct pages" do + expect(property_information.pages.map(&:id)).to eq( + %w[ + uprn + uprn_confirmation + address_matcher + no_address_found + uprn_selection + address + property_local_authority + local_authority_buyer_1_income_max_value_check + local_authority_buyer_2_income_max_value_check + local_authority_combined_income_max_value_check + about_price_la_value_check + property_unit_type + property_number_of_bedrooms + about_price_bedrooms_value_check + monthly_charges_property_type_value_check + percentage_discount_proptype_value_check + property_building_type + property_wheelchair_accessible + ], + ) + end + end end it "has the correct id" do From 7d407ab4c6abd35e1f657fc658669b0a463a1cfe Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 13 Nov 2024 11:49:56 +0000 Subject: [PATCH 19/27] CLDC-3739: Remove buyer orgs question from 2025 (#2766) --- .../form/sales/subsections/household_situation.rb | 14 +++----------- .../forms/2025/sales/household_situation.en.yml | 6 ------ .../sales/subsections/household_situation_spec.rb | 14 ++++++++------ 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/app/models/form/sales/subsections/household_situation.rb b/app/models/form/sales/subsections/household_situation.rb index 225b1ae43..2e496908b 100644 --- a/app/models/form/sales/subsections/household_situation.rb +++ b/app/models/form/sales/subsections/household_situation.rb @@ -11,17 +11,9 @@ class Form::Sales::Subsections::HouseholdSituation < ::Form::Subsection Form::Sales::Pages::Buyer1PreviousTenure.new(nil, nil, self), Form::Sales::Pages::LastAccommodation.new(nil, nil, self), Form::Sales::Pages::LastAccommodationLa.new(nil, nil, self), - Form::Sales::Pages::BuyersOrganisations.new(nil, nil, self), - buyer_2_situation_pages, + (Form::Sales::Pages::BuyersOrganisations.new(nil, nil, self) unless form.start_year_2025_or_later?), + Form::Sales::Pages::Buyer2LivingIn.new(nil, nil, self), + Form::Sales::Pages::Buyer2PreviousHousingSituation.new(nil, nil, self), ].flatten.compact end - - def buyer_2_situation_pages - if form.start_date.year >= 2023 - [ - Form::Sales::Pages::Buyer2LivingIn.new(nil, nil, self), - Form::Sales::Pages::Buyer2PreviousHousingSituation.new(nil, nil, self), - ] - end - end end diff --git a/config/locales/forms/2025/sales/household_situation.en.yml b/config/locales/forms/2025/sales/household_situation.en.yml index 3aa3545d8..6b49a7d37 100644 --- a/config/locales/forms/2025/sales/household_situation.en.yml +++ b/config/locales/forms/2025/sales/household_situation.en.yml @@ -31,12 +31,6 @@ en: hint_text: "" question_text: "Select a local authority" - buyers_organisations: - page_header: "" - check_answer_label: "Organisations buyers were registered with" - hint_text: "Select all that apply. This question is optional. If no options are applicable, leave the options blank, and select save and continue." - question_text: "What organisations were the buyers registered with?" - buy2living: page_header: "" check_answer_label: "Buyer 2 living at the same address" diff --git a/spec/models/form/sales/subsections/household_situation_spec.rb b/spec/models/form/sales/subsections/household_situation_spec.rb index 10898b27c..903960a8d 100644 --- a/spec/models/form/sales/subsections/household_situation_spec.rb +++ b/spec/models/form/sales/subsections/household_situation_spec.rb @@ -3,16 +3,15 @@ require "rails_helper" RSpec.describe Form::Sales::Subsections::HouseholdSituation, type: :model do subject(:household_characteristics) { described_class.new(nil, nil, section) } - let(:start_date) { Time.utc(2023, 4, 1) } - let(:form) { instance_double(Form, start_date:) } + let(:form) { instance_double(Form, start_year_2024_or_later?: true, start_year_2025_or_later?: false) } let(:section) { instance_double(Form::Sales::Sections::Household, form:) } it "has correct section" do expect(household_characteristics.section).to eq(section) end - context "when the log belongs to the 22/23 collection" do - let(:start_date) { Time.utc(2022, 4, 1) } + context "when the start year is 2024" do + let(:form) { instance_double(Form, start_year_2024_or_later?: true, start_year_2025_or_later?: false) } it "has correct pages" do expect(household_characteristics.pages.map(&:id)).to eq( @@ -21,19 +20,22 @@ RSpec.describe Form::Sales::Subsections::HouseholdSituation, type: :model do last_accommodation last_accommodation_la buyers_organisations + buyer_2_living_in + buyer_2_previous_housing_situation ], ) end end - context "when the log belongs to the 23/24 collection" do + context "when the start year is 2025" do + let(:form) { instance_double(Form, start_year_2024_or_later?: true, start_year_2025_or_later?: true) } + it "has correct pages" do expect(household_characteristics.pages.map(&:id)).to eq( %w[ buyer1_previous_tenure last_accommodation last_accommodation_la - buyers_organisations buyer_2_living_in buyer_2_previous_housing_situation ], From e2123f8b9dd86d4513111e5894311d3ca7996b7d Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 13 Nov 2024 14:51:13 +0000 Subject: [PATCH 20/27] CLDC-3736: Don't route to property building type or wheelchair accessibility for staircasing sales from 2025 (#2761) * CLDC-3736: Don't route to property building type or wheelchair accessibility for staircasing sales from 2025 * Add tests for routed_to? * Fix test --- .../sales/pages/property_building_type.rb | 4 ++ .../pages/property_wheelchair_accessible.rb | 4 ++ .../pages/property_building_type_spec.rb | 45 ++++++++++++++++- .../property_wheelchair_accessible_spec.rb | 49 +++++++++++++++++-- 4 files changed, 96 insertions(+), 6 deletions(-) diff --git a/app/models/form/sales/pages/property_building_type.rb b/app/models/form/sales/pages/property_building_type.rb index 40c8f3738..b9a829a64 100644 --- a/app/models/form/sales/pages/property_building_type.rb +++ b/app/models/form/sales/pages/property_building_type.rb @@ -2,6 +2,10 @@ class Form::Sales::Pages::PropertyBuildingType < ::Form::Page def initialize(id, hsh, subsection) super @id = "property_building_type" + @depends_on = [ + { "form.start_year_2025_or_later?" => false }, + { "is_staircase?" => false }, + ] end def questions diff --git a/app/models/form/sales/pages/property_wheelchair_accessible.rb b/app/models/form/sales/pages/property_wheelchair_accessible.rb index a63964059..358f16d50 100644 --- a/app/models/form/sales/pages/property_wheelchair_accessible.rb +++ b/app/models/form/sales/pages/property_wheelchair_accessible.rb @@ -2,6 +2,10 @@ class Form::Sales::Pages::PropertyWheelchairAccessible < ::Form::Page def initialize(id, hsh, subsection) super @id = "property_wheelchair_accessible" + @depends_on = [ + { "form.start_year_2025_or_later?" => false }, + { "is_staircase?" => false }, + ] end def questions diff --git a/spec/models/form/sales/pages/property_building_type_spec.rb b/spec/models/form/sales/pages/property_building_type_spec.rb index aac8fbf24..b9c6bddca 100644 --- a/spec/models/form/sales/pages/property_building_type_spec.rb +++ b/spec/models/form/sales/pages/property_building_type_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::PropertyBuildingType, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, enabled?: true, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -22,4 +23,46 @@ RSpec.describe Form::Sales::Pages::PropertyBuildingType, type: :model do it "has the correct description" do expect(page.description).to be_nil end + + context "with form year 2024" do + let(:form) { Form.new(nil, 2024, [], "sales") } + let(:saledate) { Time.zone.local(2024, 4, 1) } + + context "with a staircasing log" do + let(:log) { build(:sales_log, :shared_ownership_setup_complete, staircase: 1, saledate:) } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + + context "with a non-staircasing log" do + let(:log) { build(:sales_log, staircase: nil, saledate:) } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end + + context "with form year 2025" do + let(:form) { Form.new(nil, 2025, [], "sales") } + let(:saledate) { Time.zone.local(2025, 4, 1) } + + context "with a staircasing log" do + let(:log) { build(:sales_log, :shared_ownership_setup_complete, staircase: 1, saledate:) } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "with a non-staircasing log" do + let(:log) { build(:sales_log, staircase: nil, saledate:) } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end end diff --git a/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb b/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb index 01dcb7ce7..bf0493a6d 100644 --- a/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb @@ -5,11 +5,8 @@ RSpec.describe Form::Sales::Pages::PropertyWheelchairAccessible, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } - - before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) - end + let(:form) { instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, enabled?: true, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -26,4 +23,46 @@ RSpec.describe Form::Sales::Pages::PropertyWheelchairAccessible, type: :model do it "has the correct description" do expect(page.description).to be_nil end + + context "with form year 2024" do + let(:form) { Form.new(nil, 2024, [], "sales") } + let(:saledate) { Time.zone.local(2024, 4, 1) } + + context "with a staircasing log" do + let(:log) { build(:sales_log, :shared_ownership_setup_complete, staircase: 1, saledate:) } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + + context "with a non-staircasing log" do + let(:log) { build(:sales_log, :shared_ownership_setup_complete, staircase: 2, saledate:) } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end + + context "with form year 2025" do + let(:form) { Form.new(nil, 2025, [], "sales") } + let(:saledate) { Time.zone.local(2025, 4, 1) } + + context "with a staircasing log" do + let(:log) { build(:sales_log, :shared_ownership_setup_complete, staircase: 1, saledate:) } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "with a non-staircasing log" do + let(:log) { build(:sales_log, :shared_ownership_setup_complete, staircase: 2, saledate:) } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end end From 3125171edf50d9442b2037744f71a236f6ec62c1 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:10:08 +0000 Subject: [PATCH 21/27] CLDC-3718: Sales - Remove Q10 (Will any buyers live in the property?) (25/26) (#2757) --- app/models/form/sales/subsections/setup.rb | 2 +- config/locales/forms/2025/sales/setup.en.yml | 6 ------ spec/models/form/sales/subsections/setup_spec.rb | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index b0c7025c7..dd078c9f2 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -17,7 +17,7 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection Form::Sales::Pages::DiscountedOwnershipType.new(nil, nil, self), (Form::Sales::Pages::OutrightOwnershipType.new(nil, nil, self) unless form.start_year_2025_or_later?), Form::Sales::Pages::BuyerCompany.new(nil, nil, self), - Form::Sales::Pages::BuyerLive.new(nil, nil, self), + (Form::Sales::Pages::BuyerLive.new(nil, nil, self) unless form.start_year_2025_or_later?), Form::Sales::Pages::JointPurchase.new(nil, nil, self), Form::Sales::Pages::NumberJointBuyers.new(nil, nil, self), (Form::Sales::Pages::BuyerInterview.new("buyer_interview_joint_purchase", nil, self, joint_purchase: true) if form.start_year_2024_or_later?), diff --git a/config/locales/forms/2025/sales/setup.en.yml b/config/locales/forms/2025/sales/setup.en.yml index 105d0ad0d..fcd942243 100644 --- a/config/locales/forms/2025/sales/setup.en.yml +++ b/config/locales/forms/2025/sales/setup.en.yml @@ -57,12 +57,6 @@ en: hint_text: "" question_text: "Is the buyer a company?" - buylivein: - page_header: "" - check_answer_label: "Buyers living in property" - hint_text: "" - question_text: "Will any buyers live in the property?" - jointpur: page_header: "" check_answer_label: "Joint purchase" diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 1cd363105..7ed5546dd 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -96,7 +96,6 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do shared_ownership_type discounted_ownership_type buyer_company - buyer_live joint_purchase number_joint_buyers buyer_interview_joint_purchase From 154f4d9538f2b77dc2c1159ad7ae9b2b66a1f822 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:28:44 +0000 Subject: [PATCH 22/27] CLDC-3721: Sales - Move Q78 (Is this a staircasing transaction?) to setup section (25/26) (#2751) --- app/models/form/sales/pages/staircase.rb | 3 +- app/models/form/sales/questions/staircase.rb | 22 +++++-- app/models/form/sales/subsections/setup.rb | 1 + .../subsections/shared_ownership_scheme.rb | 2 +- .../forms/2025/sales/sale_information.en.yml | 5 -- config/locales/forms/2025/sales/setup.en.yml | 6 ++ .../models/form/sales/pages/staircase_spec.rb | 40 +++++++++--- .../form/sales/questions/staircase_spec.rb | 64 +++++++++++++------ .../form/sales/subsections/setup_spec.rb | 1 + .../shared_ownership_scheme_spec.rb | 2 +- 10 files changed, 100 insertions(+), 46 deletions(-) diff --git a/app/models/form/sales/pages/staircase.rb b/app/models/form/sales/pages/staircase.rb index 28b0d6b38..1413abadc 100644 --- a/app/models/form/sales/pages/staircase.rb +++ b/app/models/form/sales/pages/staircase.rb @@ -2,7 +2,8 @@ class Form::Sales::Pages::Staircase < ::Form::Page def initialize(id, hsh, subsection) super @id = "staircasing" - @copy_key = "sales.sale_information.staircasing" + @depends_on = [{ "ownershipsch" => 1 }] + @copy_key = "sales.#{subsection.id}.staircasing" end def questions diff --git a/app/models/form/sales/questions/staircase.rb b/app/models/form/sales/questions/staircase.rb index 9fc969735..6c98397ff 100644 --- a/app/models/form/sales/questions/staircase.rb +++ b/app/models/form/sales/questions/staircase.rb @@ -2,17 +2,25 @@ class Form::Sales::Questions::Staircase < ::Form::Question def initialize(id, hsh, page) super @id = "staircase" - @copy_key = "sales.sale_information.staircasing" + @copy_key = "sales.#{page.subsection.id}.staircasing" @type = "radio" - @answer_options = ANSWER_OPTIONS @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end - ANSWER_OPTIONS = { - "1" => { "value" => "Yes" }, - "2" => { "value" => "No" }, - "3" => { "value" => "Don’t know" }, - }.freeze + def answer_options + if form.start_year_2025_or_later? + { + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + }.freeze + else + { + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + "3" => { "value" => "Don’t know" }, + }.freeze + end + end QUESTION_NUMBER_FROM_YEAR = { 2023 => 76, 2024 => 78 }.freeze end diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index dd078c9f2..87656505f 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -13,6 +13,7 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection Form::Sales::Pages::CreatedBy.new(nil, nil, self), Form::Sales::Pages::PurchaserCode.new(nil, nil, self), Form::Sales::Pages::OwnershipScheme.new(nil, nil, self), + (Form::Sales::Pages::Staircase.new(nil, nil, self) if form.start_year_2025_or_later?), Form::Sales::Pages::SharedOwnershipType.new(nil, nil, self), Form::Sales::Pages::DiscountedOwnershipType.new(nil, nil, self), (Form::Sales::Pages::OutrightOwnershipType.new(nil, nil, self) unless form.start_year_2025_or_later?), diff --git a/app/models/form/sales/subsections/shared_ownership_scheme.rb b/app/models/form/sales/subsections/shared_ownership_scheme.rb index 3fba8ef70..455755e31 100644 --- a/app/models/form/sales/subsections/shared_ownership_scheme.rb +++ b/app/models/form/sales/subsections/shared_ownership_scheme.rb @@ -10,7 +10,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection @pages ||= [ Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_shared_ownership_joint_purchase", nil, self, ownershipsch: 1, joint_purchase: true), Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_shared_ownership", nil, self, ownershipsch: 1, joint_purchase: false), - Form::Sales::Pages::Staircase.new(nil, nil, self), + (Form::Sales::Pages::Staircase.new(nil, nil, self) unless form.start_year_2025_or_later?), Form::Sales::Pages::AboutStaircase.new("about_staircasing_joint_purchase", nil, self, joint_purchase: true), Form::Sales::Pages::AboutStaircase.new("about_staircasing_not_joint_purchase", nil, self, joint_purchase: false), Form::Sales::Pages::StaircaseBoughtValueCheck.new(nil, nil, self), diff --git a/config/locales/forms/2025/sales/sale_information.en.yml b/config/locales/forms/2025/sales/sale_information.en.yml index 51270a92e..33826e58b 100644 --- a/config/locales/forms/2025/sales/sale_information.en.yml +++ b/config/locales/forms/2025/sales/sale_information.en.yml @@ -25,11 +25,6 @@ en: hint_text: "" question_text: "Did the buyer live in the property before purchasing it?" - staircasing: - page_header: "" - check_answer_label: "Staircasing transaction" - hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" - question_text: "Is this a staircasing transaction?" about_staircasing: page_header: "About the staircasing transaction" stairbought: diff --git a/config/locales/forms/2025/sales/setup.en.yml b/config/locales/forms/2025/sales/setup.en.yml index fcd942243..996ec5df3 100644 --- a/config/locales/forms/2025/sales/setup.en.yml +++ b/config/locales/forms/2025/sales/setup.en.yml @@ -39,6 +39,12 @@ en: hint_text: "" question_text: "Was this purchase made through an ownership scheme?" + staircasing: + page_header: "" + check_answer_label: "Staircasing transaction" + hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" + question_text: "Is this a staircasing transaction?" + type: shared_ownership: page_header: "Type of shared ownership sale" diff --git a/spec/models/form/sales/pages/staircase_spec.rb b/spec/models/form/sales/pages/staircase_spec.rb index 6f17e7e89..3c26181c2 100644 --- a/spec/models/form/sales/pages/staircase_spec.rb +++ b/spec/models/form/sales/pages/staircase_spec.rb @@ -7,19 +7,39 @@ RSpec.describe Form::Sales::Pages::Staircase, type: :model do let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end + context "when start year is 2024" do + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)), id: "sale_information") } - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[staircase]) - end + before do + allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(false) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[staircase]) + end - it "has the correct id" do - expect(page.id).to eq("staircasing") + it "has the correct id" do + expect(page.id).to eq("staircasing") + end + + it "has the correct description" do + expect(page.description).to be_nil + end end - it "has the correct description" do - expect(page.description).to be_nil + context "when start year is >= 2025" do + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)), id: "setup") } + + before do + allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end end end diff --git a/spec/models/form/sales/questions/staircase_spec.rb b/spec/models/form/sales/questions/staircase_spec.rb index 7b45891da..29ba34d31 100644 --- a/spec/models/form/sales/questions/staircase_spec.rb +++ b/spec/models/form/sales/questions/staircase_spec.rb @@ -5,33 +5,55 @@ RSpec.describe Form::Sales::Questions::Staircase, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } - it "has correct page" do - expect(question.page).to eq(page) - end + context "when start year is 2024" do + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1)), id: "sale_information")) } - it "has the correct id" do - expect(question.id).to eq("staircase") - end + before do + allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(false) + end - it "has the correct type" do - expect(question.type).to eq("radio") - end + it "has correct page" do + expect(question.page).to eq(page) + end - it "is not marked as derived" do - expect(question.derived?(nil)).to be false - end + it "has the correct id" do + expect(question.id).to eq("staircase") + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end - it "has the correct answer_options" do - expect(question.answer_options).to eq({ - "1" => { "value" => "Yes" }, - "2" => { "value" => "No" }, - "3" => { "value" => "Don’t know" }, - }) + it "is not marked as derived" do + expect(question.derived?(nil)).to be false + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + "3" => { "value" => "Don’t know" }, + }) + end + + it "has correct conditional for" do + expect(question.conditional_for).to eq(nil) + end end - it "has correct conditional for" do - expect(question.conditional_for).to eq(nil) + context "when start year is 2025" do + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1)), id: "setup")) } + + before do + allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + }) + end end end diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 7ed5546dd..1731ab256 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -93,6 +93,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do assigned_to purchaser_code ownership_scheme + staircasing shared_ownership_type discounted_ownership_type buyer_company diff --git a/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb b/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb index 8c5674d0b..4c546d58c 100644 --- a/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb +++ b/spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Sales::Subsections::SharedOwnershipScheme, type: :model do let(:section) { instance_double(Form::Sales::Sections::SaleInformation) } before do - allow(section).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) + allow(section).to receive(:form).and_return(instance_double(Form, start_year_2024_or_later?: false, start_year_2025_or_later?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct section" do From 1a07e37049fadccfa43d9166f3d245ce9b270a0d Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:51:50 +0000 Subject: [PATCH 23/27] CLDC-3717: Sales - Remove Q9 (Is the buyer a company?) (25/26) (#2755) --- app/models/form/sales/pages/buyer_live.rb | 7 ++- app/models/form/sales/pages/joint_purchase.rb | 20 +++++-- app/models/form/sales/subsections/setup.rb | 2 +- config/locales/forms/2025/sales/setup.en.yml | 6 -- .../form/sales/pages/buyer_live_spec.rb | 58 +++++++++++------- .../form/sales/pages/joint_purchase_spec.rb | 60 +++++++++++++------ .../form/sales/subsections/setup_spec.rb | 1 - 7 files changed, 100 insertions(+), 54 deletions(-) diff --git a/app/models/form/sales/pages/buyer_live.rb b/app/models/form/sales/pages/buyer_live.rb index d0b772355..8bde09ddb 100644 --- a/app/models/form/sales/pages/buyer_live.rb +++ b/app/models/form/sales/pages/buyer_live.rb @@ -2,9 +2,10 @@ class Form::Sales::Pages::BuyerLive < ::Form::Page def initialize(id, hsh, subsection) super @id = "buyer_live" - @depends_on = [{ - "companybuy" => 2, - }] + end + + def depends_on + [{ "companybuy" => 2 }] unless form.start_year_2025_or_later? end def questions diff --git a/app/models/form/sales/pages/joint_purchase.rb b/app/models/form/sales/pages/joint_purchase.rb index bec7c88c1..a8382d1fb 100644 --- a/app/models/form/sales/pages/joint_purchase.rb +++ b/app/models/form/sales/pages/joint_purchase.rb @@ -2,11 +2,21 @@ class Form::Sales::Pages::JointPurchase < ::Form::Page def initialize(id, hsh, subsection) super @id = "joint_purchase" - @depends_on = [ - { "ownershipsch" => 1 }, - { "ownershipsch" => 2 }, - { "companybuy" => 2 }, - ] + end + + def depends_on + if form.start_year_2025_or_later? + [ + { "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + ] + else + [ + { "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + { "companybuy" => 2 }, + ] + end end def questions diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index 87656505f..0c667ebda 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -17,7 +17,7 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection Form::Sales::Pages::SharedOwnershipType.new(nil, nil, self), Form::Sales::Pages::DiscountedOwnershipType.new(nil, nil, self), (Form::Sales::Pages::OutrightOwnershipType.new(nil, nil, self) unless form.start_year_2025_or_later?), - Form::Sales::Pages::BuyerCompany.new(nil, nil, self), + (Form::Sales::Pages::BuyerCompany.new(nil, nil, self) unless form.start_year_2025_or_later?), (Form::Sales::Pages::BuyerLive.new(nil, nil, self) unless form.start_year_2025_or_later?), Form::Sales::Pages::JointPurchase.new(nil, nil, self), Form::Sales::Pages::NumberJointBuyers.new(nil, nil, self), diff --git a/config/locales/forms/2025/sales/setup.en.yml b/config/locales/forms/2025/sales/setup.en.yml index 996ec5df3..6f7c5da98 100644 --- a/config/locales/forms/2025/sales/setup.en.yml +++ b/config/locales/forms/2025/sales/setup.en.yml @@ -57,12 +57,6 @@ en: hint_text: "" question_text: "What is the type of discounted ownership sale?" - companybuy: - page_header: "" - check_answer_label: "Company buyer" - hint_text: "" - question_text: "Is the buyer a company?" - jointpur: page_header: "" check_answer_label: "Joint purchase" diff --git a/spec/models/form/sales/pages/buyer_live_spec.rb b/spec/models/form/sales/pages/buyer_live_spec.rb index ac5ac2c27..1880c37e3 100644 --- a/spec/models/form/sales/pages/buyer_live_spec.rb +++ b/spec/models/form/sales/pages/buyer_live_spec.rb @@ -8,32 +8,50 @@ RSpec.describe Form::Sales::Pages::BuyerLive, type: :model do let(:page_id) { nil } let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form, start_date: current_collection_start_date) } - before do - allow(form).to receive(:start_year_2024_or_later?).and_return(true) - allow(subsection).to receive(:form).and_return(form) - end + context "when start year is 2024" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end + before do + allow(form).to receive(:start_year_2024_or_later?).and_return(true) + allow(form).to receive(:start_year_2025_or_later?).and_return(false) + allow(subsection).to receive(:form).and_return(form) + end - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[buylivein]) - end + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end - it "has the correct id" do - expect(page.id).to eq("buyer_live") - end + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[buylivein]) + end - it "has the correct description" do - expect(page.description).to be_nil + it "has the correct id" do + expect(page.id).to eq("buyer_live") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has correct depends_on" do + expect(page.depends_on).to eq([{ + "companybuy" => 2, + }]) + end end - it "has correct depends_on" do - expect(page.depends_on).to eq([{ - "companybuy" => 2, - }]) + context "when start year is 2025" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2025, 4, 1)) } + + before do + allow(form).to receive(:start_year_2024_or_later?).and_return(true) + allow(form).to receive(:start_year_2025_or_later?).and_return(true) + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct depends_on" do + expect(page.depends_on).to be_nil + end end end diff --git a/spec/models/form/sales/pages/joint_purchase_spec.rb b/spec/models/form/sales/pages/joint_purchase_spec.rb index 4ccefd03d..bba9384ad 100644 --- a/spec/models/form/sales/pages/joint_purchase_spec.rb +++ b/spec/models/form/sales/pages/joint_purchase_spec.rb @@ -5,29 +5,53 @@ RSpec.describe Form::Sales::Pages::JointPurchase, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end + context "when start year is 2024" do + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1))) } - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[jointpur]) - end + before do + allow(subsection.form).to receive(:start_year_2024_or_later?).and_return(true) + allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(false) + end - it "has the correct id" do - expect(page.id).to eq("joint_purchase") - end + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[jointpur]) + end - it "has the correct description" do - expect(page.description).to be_nil + it "has the correct id" do + expect(page.id).to eq("joint_purchase") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has correct depends_on" do + expect(page.depends_on).to eq([ + { "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + { "companybuy" => 2 }, + ]) + end end - it "has correct depends_on" do - expect(page.depends_on).to eq([ - { "ownershipsch" => 1 }, - { "ownershipsch" => 2 }, - { "companybuy" => 2 }, - ]) + context "when start year is 2025" do + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } + + before do + allow(subsection.form).to receive(:start_year_2024_or_later?).and_return(true) + allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has correct depends_on" do + expect(page.depends_on).to eq([ + { "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + ]) + end end end diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 1731ab256..ad01ccd41 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -96,7 +96,6 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do staircasing shared_ownership_type discounted_ownership_type - buyer_company joint_purchase number_joint_buyers buyer_interview_joint_purchase From 4886cdbe36477bd7e4190e32181a3bd461556f9b Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:31:37 +0000 Subject: [PATCH 24/27] CLDC-3722: Sales - Remove from Q5 'outright or other sale' answer option (25/26) (#2752) --- .../form/sales/questions/ownership_scheme.rb | 7 ++++++- .../sales/questions/ownership_scheme_spec.rb | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/models/form/sales/questions/ownership_scheme.rb b/app/models/form/sales/questions/ownership_scheme.rb index f42f03f37..5eacb8f26 100644 --- a/app/models/form/sales/questions/ownership_scheme.rb +++ b/app/models/form/sales/questions/ownership_scheme.rb @@ -7,7 +7,12 @@ class Form::Sales::Questions::OwnershipScheme < ::Form::Question end def answer_options - if form.start_year_2024_or_later? + if form.start_year_2025_or_later? + { + "1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" }, + "2" => { "value" => "Yes - a discounted ownership scheme" }, + }.freeze + elsif form.start_year_2024_or_later? { "1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" }, "2" => { "value" => "Yes - a discounted ownership scheme" }, diff --git a/spec/models/form/sales/questions/ownership_scheme_spec.rb b/spec/models/form/sales/questions/ownership_scheme_spec.rb index 222ec180d..647de9621 100644 --- a/spec/models/form/sales/questions/ownership_scheme_spec.rb +++ b/spec/models/form/sales/questions/ownership_scheme_spec.rb @@ -11,6 +11,7 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do before do allow(form).to receive(:start_year_2024_or_later?).and_return(false) + allow(form).to receive(:start_year_2025_or_later?).and_return(false) allow(page).to receive(:subsection).and_return(subsection) allow(subsection).to receive(:form).and_return(form) end @@ -39,7 +40,7 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do }) end - context "with collection year on or after 2024" do + context "with collection year in 2024" do before do allow(form).to receive(:start_year_2024_or_later?).and_return(true) end @@ -52,4 +53,18 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do }) end end + + context "with collection year on or after 2025" do + before do + allow(form).to receive(:start_year_2024_or_later?).and_return(true) + allow(form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" }, + "2" => { "value" => "Yes - a discounted ownership scheme" }, + }) + end + end end From e87c3f403f3481d2e3768cb0632b463df2792d50 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 13 Nov 2024 16:32:31 +0000 Subject: [PATCH 25/27] Add merge queue trigger to staging pipeline (#2776) --- .github/workflows/staging_pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/staging_pipeline.yml b/.github/workflows/staging_pipeline.yml index 8c0553741..e5447f4ef 100644 --- a/.github/workflows/staging_pipeline.yml +++ b/.github/workflows/staging_pipeline.yml @@ -8,6 +8,7 @@ on: types: - opened - synchronize + merge_group: workflow_dispatch: defaults: From fbeaee9368d50e19fd756da1c83db6514b6a7a76 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 13 Nov 2024 16:38:05 +0000 Subject: [PATCH 26/27] CLDC-3733: Adjust ordering for working situation question (#2762) * CLDC-3733: Adjust ordering for working situation question * Fix tests --- .../questions/buyer1_working_situation.rb | 43 ++++++++---- .../questions/buyer2_working_situation.rb | 43 ++++++++---- .../questions/person_working_situation.rb | 66 +++++++++++++------ .../pages/buyer1_working_situation_spec.rb | 2 +- .../pages/buyer2_working_situation_spec.rb | 2 +- .../pages/person_working_situation_spec.rb | 2 +- .../buyer1_working_situation_spec.rb | 19 +++++- .../buyer2_working_situation_spec.rb | 19 +++++- .../person_working_situation_spec.rb | 19 +++++- 9 files changed, 162 insertions(+), 53 deletions(-) diff --git a/app/models/form/sales/questions/buyer1_working_situation.rb b/app/models/form/sales/questions/buyer1_working_situation.rb index b00db033f..dbbc24eff 100644 --- a/app/models/form/sales/questions/buyer1_working_situation.rb +++ b/app/models/form/sales/questions/buyer1_working_situation.rb @@ -3,7 +3,7 @@ class Form::Sales::Questions::Buyer1WorkingSituation < ::Form::Question super @id = "ecstat1" @type = "radio" - @answer_options = ANSWER_OPTIONS + @answer_options = answer_options @check_answers_card_number = 1 @inferred_check_answers_value = [{ "condition" => { @@ -14,18 +14,35 @@ class Form::Sales::Questions::Buyer1WorkingSituation < ::Form::Question @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end - ANSWER_OPTIONS = { - "1" => { "value" => "Full-time - 30 hours or more" }, - "2" => { "value" => "Part-time - Less than 30 hours" }, - "3" => { "value" => "In government training into work" }, - "4" => { "value" => "Jobseeker" }, - "6" => { "value" => "Not seeking work" }, - "8" => { "value" => "Unable to work due to long term sick or disability" }, - "5" => { "value" => "Retired" }, - "0" => { "value" => "Other" }, - "10" => { "value" => "Buyer prefers not to say" }, - "7" => { "value" => "Full-time student" }, - }.freeze + def answer_options + if form.start_year_2025_or_later? + { + "1" => { "value" => "Full-time - 30 hours or more" }, + "2" => { "value" => "Part-time - Less than 30 hours" }, + "3" => { "value" => "In government training into work" }, + "4" => { "value" => "Jobseeker" }, + "5" => { "value" => "Retired" }, + "6" => { "value" => "Not seeking work" }, + "7" => { "value" => "Full-time student" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Buyer prefers not to say" }, + }.freeze + else + { + "1" => { "value" => "Full-time - 30 hours or more" }, + "2" => { "value" => "Part-time - Less than 30 hours" }, + "3" => { "value" => "In government training into work" }, + "4" => { "value" => "Jobseeker" }, + "6" => { "value" => "Not seeking work" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "5" => { "value" => "Retired" }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Buyer prefers not to say" }, + "7" => { "value" => "Full-time student" }, + }.freeze + end + end QUESTION_NUMBER_FROM_YEAR = { 2023 => 25, 2024 => 27 }.freeze end diff --git a/app/models/form/sales/questions/buyer2_working_situation.rb b/app/models/form/sales/questions/buyer2_working_situation.rb index 5356cb8e8..38ab320b3 100644 --- a/app/models/form/sales/questions/buyer2_working_situation.rb +++ b/app/models/form/sales/questions/buyer2_working_situation.rb @@ -4,7 +4,7 @@ class Form::Sales::Questions::Buyer2WorkingSituation < ::Form::Question @id = "ecstat2" @copy_key = "sales.household_characteristics.ecstat2.buyer" @type = "radio" - @answer_options = ANSWER_OPTIONS + @answer_options = answer_options @check_answers_card_number = 2 @inferred_check_answers_value = [{ "condition" => { @@ -15,18 +15,35 @@ class Form::Sales::Questions::Buyer2WorkingSituation < ::Form::Question @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end - ANSWER_OPTIONS = { - "1" => { "value" => "Full-time - 30 hours or more" }, - "2" => { "value" => "Part-time - Less than 30 hours" }, - "3" => { "value" => "In government training into work" }, - "4" => { "value" => "Jobseeker" }, - "6" => { "value" => "Not seeking work" }, - "8" => { "value" => "Unable to work due to long term sick or disability" }, - "5" => { "value" => "Retired" }, - "0" => { "value" => "Other" }, - "10" => { "value" => "Buyer prefers not to say" }, - "7" => { "value" => "Full-time student" }, - }.freeze + def answer_options + if form.start_year_2025_or_later? + { + "1" => { "value" => "Full-time - 30 hours or more" }, + "2" => { "value" => "Part-time - Less than 30 hours" }, + "3" => { "value" => "In government training into work" }, + "4" => { "value" => "Jobseeker" }, + "5" => { "value" => "Retired" }, + "6" => { "value" => "Not seeking work" }, + "7" => { "value" => "Full-time student" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Buyer prefers not to say" }, + }.freeze + else + { + "1" => { "value" => "Full-time - 30 hours or more" }, + "2" => { "value" => "Part-time - Less than 30 hours" }, + "3" => { "value" => "In government training into work" }, + "4" => { "value" => "Jobseeker" }, + "6" => { "value" => "Not seeking work" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "5" => { "value" => "Retired" }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Buyer prefers not to say" }, + "7" => { "value" => "Full-time student" }, + }.freeze + end + end QUESTION_NUMBER_FROM_YEAR = { 2023 => 33, 2024 => 35 }.freeze end diff --git a/app/models/form/sales/questions/person_working_situation.rb b/app/models/form/sales/questions/person_working_situation.rb index 488a77092..f3fbebd6f 100644 --- a/app/models/form/sales/questions/person_working_situation.rb +++ b/app/models/form/sales/questions/person_working_situation.rb @@ -16,27 +16,51 @@ class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question end def answer_options - { - "1" => { "value" => "Full-time - 30 hours or more" }, - "2" => { "value" => "Part-time - Less than 30 hours" }, - "3" => { "value" => "In government training into work" }, - "4" => { "value" => "Jobseeker" }, - "6" => { "value" => "Not seeking work" }, - "8" => { "value" => "Unable to work due to long term sick or disability" }, - "5" => { "value" => "Retired" }, - "0" => { "value" => "Other" }, - "10" => { "value" => "Person prefers not to say" }, - "7" => { "value" => "Full-time student" }, - "9" => { - "value" => "Child under 16", - "depends_on" => [ - { "saledate" => { "operator" => "<", "operand" => Time.zone.local(2024, 4, 1) } }, - { "age#{@person_index}_known" => 1 }, - { "age#{@person_index}_known" => nil }, - { "age#{@person_index}" => { "operator" => "<", "operand" => 16 } }, - ], - }, - } + if form.start_year_2025_or_later? + { + "1" => { "value" => "Full-time - 30 hours or more" }, + "2" => { "value" => "Part-time - Less than 30 hours" }, + "3" => { "value" => "In government training into work" }, + "4" => { "value" => "Jobseeker" }, + "5" => { "value" => "Retired" }, + "6" => { "value" => "Not seeking work" }, + "7" => { "value" => "Full-time student" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "9" => { + "value" => "Child under 16", + "depends_on" => [ + { "saledate" => { "operator" => "<", "operand" => Time.zone.local(2024, 4, 1) } }, + { "age#{@person_index}_known" => 1 }, + { "age#{@person_index}_known" => nil }, + { "age#{@person_index}" => { "operator" => "<", "operand" => 16 } }, + ], + }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Person prefers not to say" }, + } + else + { + "1" => { "value" => "Full-time - 30 hours or more" }, + "2" => { "value" => "Part-time - Less than 30 hours" }, + "3" => { "value" => "In government training into work" }, + "4" => { "value" => "Jobseeker" }, + "6" => { "value" => "Not seeking work" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "5" => { "value" => "Retired" }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Person prefers not to say" }, + "7" => { "value" => "Full-time student" }, + "9" => { + "value" => "Child under 16", + "depends_on" => [ + { "saledate" => { "operator" => "<", "operand" => Time.zone.local(2024, 4, 1) } }, + { "age#{@person_index}_known" => 1 }, + { "age#{@person_index}_known" => nil }, + { "age#{@person_index}" => { "operator" => "<", "operand" => 16 } }, + ], + }, + } + end end def question_number diff --git a/spec/models/form/sales/pages/buyer1_working_situation_spec.rb b/spec/models/form/sales/pages/buyer1_working_situation_spec.rb index fb8529967..182da0a82 100644 --- a/spec/models/form/sales/pages/buyer1_working_situation_spec.rb +++ b/spec/models/form/sales/pages/buyer1_working_situation_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer1WorkingSituation, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false)) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: true, start_year_2025_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/buyer2_working_situation_spec.rb b/spec/models/form/sales/pages/buyer2_working_situation_spec.rb index 0b7708303..6c9915903 100644 --- a/spec/models/form/sales/pages/buyer2_working_situation_spec.rb +++ b/spec/models/form/sales/pages/buyer2_working_situation_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::Buyer2WorkingSituation, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2025_or_later?: false)) } it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/sales/pages/person_working_situation_spec.rb b/spec/models/form/sales/pages/person_working_situation_spec.rb index 53c127e16..91d23f34f 100644 --- a/spec/models/form/sales/pages/person_working_situation_spec.rb +++ b/spec/models/form/sales/pages/person_working_situation_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Form::Sales::Pages::PersonWorkingSituation, type: :model do subject(:page) { described_class.new(page_id, page_definition, subsection, person_index:) } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2025_or_later?: false)) } let(:person_index) { 2 } let(:page_id) { "person_2_working_situation" } diff --git a/spec/models/form/sales/questions/buyer1_working_situation_spec.rb b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb index e25eb2aaf..0e1b02257 100644 --- a/spec/models/form/sales/questions/buyer1_working_situation_spec.rb +++ b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false))) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2025_or_later?: false) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:)) } it "has correct page" do expect(question.page).to eq(page) @@ -38,6 +39,22 @@ RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do }) end + context "with start year before 2025" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2025_or_later?: false) } + + it "uses the old ordering for answer options" do + expect(question.answer_options.keys).to eq(%w[1 2 3 4 6 8 5 0 10 7]) + end + end + + context "with start year from 2025" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2025, 4, 1), start_year_2025_or_later?: true) } + + it "uses the new ordering for answer options" do + expect(question.answer_options.keys).to eq(%w[1 2 3 4 5 6 7 8 0 10]) + end + end + it "has the correct check_answers_card_number" do expect(question.check_answers_card_number).to eq(1) end diff --git a/spec/models/form/sales/questions/buyer2_working_situation_spec.rb b/spec/models/form/sales/questions/buyer2_working_situation_spec.rb index 81d1e052f..7b825185c 100644 --- a/spec/models/form/sales/questions/buyer2_working_situation_spec.rb +++ b/spec/models/form/sales/questions/buyer2_working_situation_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Questions::Buyer2WorkingSituation, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2025_or_later?: false) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:)) } it "has correct page" do expect(question.page).to eq(page) @@ -38,6 +39,22 @@ RSpec.describe Form::Sales::Questions::Buyer2WorkingSituation, type: :model do }) end + context "with start year before 2025" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2025_or_later?: false) } + + it "uses the old ordering for answer options" do + expect(question.answer_options.keys).to eq(%w[1 2 3 4 6 8 5 0 10 7]) + end + end + + context "with start year from 2025" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2025, 4, 1), start_year_2025_or_later?: true) } + + it "uses the new ordering for answer options" do + expect(question.answer_options.keys).to eq(%w[1 2 3 4 5 6 7 8 0 10]) + end + end + it "has the correct check_answers_card_number" do expect(question.check_answers_card_number).to eq(2) end diff --git a/spec/models/form/sales/questions/person_working_situation_spec.rb b/spec/models/form/sales/questions/person_working_situation_spec.rb index a9f5316cd..b09c0bf69 100644 --- a/spec/models/form/sales/questions/person_working_situation_spec.rb +++ b/spec/models/form/sales/questions/person_working_situation_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do let(:question_id) { "ecstat2" } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2025_or_later?: false) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:)) } let(:person_index) { 2 } it "has correct page" do @@ -41,6 +42,22 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do }) end + context "with start year before 2025" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2025_or_later?: false) } + + it "uses the old ordering for answer options" do + expect(question.answer_options.keys).to eq(%w[1 2 3 4 6 8 5 0 10 7 9]) + end + end + + context "with start year from 2025" do + let(:form) { instance_double(Form, start_date: Time.zone.local(2025, 4, 1), start_year_2025_or_later?: true) } + + it "uses the new ordering for answer options" do + expect(question.answer_options.keys).to eq(%w[1 2 3 4 5 6 7 8 9 0 10]) + end + end + context "when person 2" do let(:question_id) { "ecstat2" } let(:person_index) { 2 } From 2b629891fb1e35e847d178ff64b31f0b452c3bec Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 13 Nov 2024 16:52:13 +0000 Subject: [PATCH 27/27] CLDC-3666: Pull sales financial validations into translations file (#2716) --- .../sales/financial_validations.rb | 48 ++++--- config/locales/en.yml | 22 +-- .../validations/sales/financial.en.yml | 81 +++++++++++ .../sales/financial_validations_spec.rb | 134 +++++++++--------- 4 files changed, 175 insertions(+), 110 deletions(-) create mode 100644 config/locales/validations/sales/financial.en.yml diff --git a/app/models/validations/sales/financial_validations.rb b/app/models/validations/sales/financial_validations.rb index c1046e035..1d2ef3d6f 100644 --- a/app/models/validations/sales/financial_validations.rb +++ b/app/models/validations/sales/financial_validations.rb @@ -7,9 +7,9 @@ module Validations::Sales::FinancialValidations relevant_fields = %i[income1 ownershipsch uprn la postcode_full] if record.london_property? && !record.income1.between?(0, 90_000) - relevant_fields.each { |field| record.errors.add field, :outside_london_income_range, message: I18n.t("validations.financial.income.outside_london_income_range") } + relevant_fields.each { |field| record.errors.add field, :outside_london_income_range, message: I18n.t("validations.sales.financial.#{field}.outside_london_income_range") } elsif record.property_not_in_london? && !record.income1.between?(0, 80_000) - relevant_fields.each { |field| record.errors.add field, :outside_non_london_income_range, message: I18n.t("validations.financial.income.outside_non_london_income_range") } + relevant_fields.each { |field| record.errors.add field, :outside_non_london_income_range, message: I18n.t("validations.sales.financial.#{field}.outside_non_london_income_range") } end end @@ -18,9 +18,9 @@ module Validations::Sales::FinancialValidations relevant_fields = %i[income2 ownershipsch uprn la postcode_full] if record.london_property? && !record.income2.between?(0, 90_000) - relevant_fields.each { |field| record.errors.add field, :outside_london_income_range, message: I18n.t("validations.financial.income.outside_london_income_range") } + relevant_fields.each { |field| record.errors.add field, :outside_london_income_range, message: I18n.t("validations.sales.financial.#{field}.outside_london_income_range") } elsif record.property_not_in_london? && !record.income2.between?(0, 80_000) - relevant_fields.each { |field| record.errors.add field, :outside_non_london_income_range, message: I18n.t("validations.financial.income.outside_non_london_income_range") } + relevant_fields.each { |field| record.errors.add field, :outside_non_london_income_range, message: I18n.t("validations.sales.financial.#{field}.outside_non_london_income_range") } end end @@ -30,25 +30,26 @@ module Validations::Sales::FinancialValidations combined_income = record.income1 + record.income2 relevant_fields = %i[income1 income2 ownershipsch uprn la postcode_full] if record.london_property? && combined_income > 90_000 - relevant_fields.each { |field| record.errors.add field, :over_combined_hard_max_for_london, message: I18n.t("validations.financial.income.combined_over_hard_max_for_london") } + relevant_fields.each { |field| record.errors.add field, :over_combined_hard_max_for_london, message: I18n.t("validations.sales.financial.#{field}.combined_over_hard_max_for_london") } elsif record.property_not_in_london? && combined_income > 80_000 - relevant_fields.each { |field| record.errors.add field, :over_combined_hard_max_for_outside_london, message: I18n.t("validations.financial.income.combined_over_hard_max_for_outside_london") } + relevant_fields.each { |field| record.errors.add field, :over_combined_hard_max_for_outside_london, message: I18n.t("validations.sales.financial.#{field}.combined_over_hard_max_for_outside_london") } end end def validate_mortgage(record) - record.errors.add :mortgage, :cannot_be_0, message: I18n.t("validations.financial.mortgage") if record.mortgage_used? && record.mortgage&.zero? + record.errors.add :mortgage, :cannot_be_0, message: I18n.t("validations.sales.financial.mortgage.mortgage_zero") if record.mortgage_used? && record.mortgage&.zero? end def validate_monthly_leasehold_charges(record) - record.errors.add :mscharge, I18n.t("validations.financial.monthly_leasehold_charges.not_zero") if record.mscharge&.zero? + record.errors.add :mscharge, I18n.t("validations.sales.financial.mscharge.monthly_leasehold_charges.not_zero") if record.mscharge&.zero? end def validate_percentage_bought_not_greater_than_percentage_owned(record) return unless record.stairbought && record.stairowned if record.stairbought > record.stairowned - record.errors.add :stairowned, I18n.t("validations.financial.staircasing.percentage_bought_must_be_greater_than_percentage_owned", buyer_now_owns: record.joint_purchase? ? "buyers now own" : "buyer now owns") + joint_purchase_id = record.joint_purchase? ? "joint_purchase" : "not_joint_purchase" + record.errors.add :stairowned, I18n.t("validations.sales.financial.stairowned.percentage_bought_must_be_greater_than_percentage_owned.#{joint_purchase_id}") end end @@ -57,8 +58,8 @@ module Validations::Sales::FinancialValidations return unless record.saledate && record.form.start_year_2024_or_later? if record.stairbought == record.stairowned - record.errors.add :stairbought, I18n.t("validations.financial.staircasing.percentage_bought_equal_percentage_owned", stairbought: sprintf("%g", record.stairbought), stairowned: sprintf("%g", record.stairowned)) - record.errors.add :stairowned, I18n.t("validations.financial.staircasing.percentage_bought_equal_percentage_owned", stairbought: sprintf("%g", record.stairbought), stairowned: sprintf("%g", record.stairowned)) + record.errors.add :stairbought, I18n.t("validations.sales.financial.stairbought.percentage_bought_equal_percentage_owned", stairbought: sprintf("%g", record.stairbought), stairowned: sprintf("%g", record.stairowned)) + record.errors.add :stairowned, I18n.t("validations.sales.financial.stairowned.percentage_bought_equal_percentage_owned", stairbought: sprintf("%g", record.stairbought), stairowned: sprintf("%g", record.stairowned)) end end @@ -72,8 +73,8 @@ module Validations::Sales::FinancialValidations end if threshold && record.stairbought < threshold - record.errors.add :stairbought, I18n.t("validations.financial.staircasing.percentage_bought_must_be_at_least_threshold", threshold:) - record.errors.add :type, I18n.t("validations.setup.type.percentage_bought_must_be_at_least_threshold", threshold:) + record.errors.add :stairbought, I18n.t("validations.sales.financial.stairbought.percentage_bought_must_be_at_least_threshold", threshold:) + record.errors.add :type, I18n.t("validations.sales.financial.type.percentage_bought_must_be_at_least_threshold", threshold:) end end @@ -81,8 +82,8 @@ module Validations::Sales::FinancialValidations return unless record.income2 && record.ecstat2 if record.income2.positive? && is_economic_status_child?(record.ecstat2) && record.form.start_date.year >= 2023 - record.errors.add :ecstat2, I18n.t("validations.financial.income.child_has_income") - record.errors.add :income2, I18n.t("validations.financial.income.child_has_income") + record.errors.add :ecstat2, I18n.t("validations.sales.financial.ecstat2.child_has_income") + record.errors.add :income2, I18n.t("validations.sales.financial.income2.child_has_income") end end @@ -94,12 +95,12 @@ module Validations::Sales::FinancialValidations return unless (range = ranges[record.type]) if record.equity < range.min - record.errors.add :type, I18n.t("validations.financial.equity.under_min", min_equity: range.min) - record.errors.add :equity, :under_min, message: I18n.t("validations.financial.equity.under_min", min_equity: range.min) + record.errors.add :type, I18n.t("validations.sales.financial.type.equity_under_min", min_equity: range.min) + record.errors.add :equity, :under_min, message: I18n.t("validations.sales.financial.equity.equity_under_min", min_equity: range.min) elsif !record.is_resale? && record.equity > range.max - record.errors.add :type, I18n.t("validations.financial.equity.over_max", max_equity: range.max) - record.errors.add :equity, :over_max, message: I18n.t("validations.financial.equity.over_max", max_equity: range.max) - record.errors.add :resale, I18n.t("validations.financial.equity.over_max", max_equity: range.max) + record.errors.add :type, I18n.t("validations.sales.financial.type.equity_over_max", max_equity: range.max) + record.errors.add :equity, :over_max, message: I18n.t("validations.sales.financial.equity.equity_over_max", max_equity: range.max) + record.errors.add :resale, I18n.t("validations.sales.financial.resale.equity_over_max", max_equity: range.max) end end @@ -109,9 +110,10 @@ module Validations::Sales::FinancialValidations if record.equity > record.stairowned - record.stairbought formatted_equity = sprintf("%g", record.equity) - record.errors.add :equity, I18n.t("validations.financial.equity.over_stairowned_minus_stairbought", equity: formatted_equity, staircase_difference: record.stairowned - record.stairbought, buyer_owns: record.joint_purchase? ? "buyers own" : "buyer owns") - record.errors.add :stairowned, I18n.t("validations.financial.equity.over_stairowned_minus_stairbought", equity: formatted_equity, staircase_difference: record.stairowned - record.stairbought, buyer_owns: record.joint_purchase? ? "buyers own" : "buyer owns") - record.errors.add :stairbought, I18n.t("validations.financial.equity.over_stairowned_minus_stairbought", equity: formatted_equity, staircase_difference: record.stairowned - record.stairbought, buyer_owns: record.joint_purchase? ? "buyers own" : "buyer owns") + joint_purchase_id = record.joint_purchase? ? "joint_purchase" : "not_joint_purchase" + record.errors.add :equity, I18n.t("validations.sales.financial.equity.equity_over_stairowned_minus_stairbought.#{joint_purchase_id}", equity: formatted_equity, staircase_difference: record.stairowned - record.stairbought) + record.errors.add :stairowned, I18n.t("validations.sales.financial.stairowned.equity_over_stairowned_minus_stairbought.#{joint_purchase_id}", equity: formatted_equity, staircase_difference: record.stairowned - record.stairbought) + record.errors.add :stairbought, I18n.t("validations.sales.financial.stairbought.equity_over_stairowned_minus_stairbought.#{joint_purchase_id}", equity: formatted_equity, staircase_difference: record.stairowned - record.stairbought) end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 8cf9634b5..1c8f49dfb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -258,8 +258,6 @@ en: setup: saledate: year_not_two_or_four_digits: "Sale completion year must be 2 or 4 digits." - type: - percentage_bought_must_be_at_least_threshold: "The minimum increase in equity while staircasing is %{threshold}% for this shared ownership type." startdate: before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme." owning_organisation: @@ -285,28 +283,14 @@ en: one_three_bedroom_single_tenant_shared: "A shared house with fewer than two tenants must have 1 to 3 bedrooms." financial: - income: - outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." - outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." - combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." - combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." - child_has_income: "Child's income must be £0." charges: missing_charges: "Please enter the %{sentence_fragment}. If there is no %{sentence_fragment}, please enter '0'." carehome: not_provided: "Enter how much rent and other charges the household pays %{period}." cash_discount_invalid: "Cash discount must be £0 - £999,999." - staircasing: - percentage_bought_must_be_greater_than_percentage_owned: "Total percentage %{buyer_now_owns} must be more than percentage bought in this transaction." - percentage_bought_must_be_at_least_threshold: "The minimum increase in equity while staircasing is %{threshold}%." - percentage_bought_equal_percentage_owned: "The percentage bought is %{stairbought}% and the percentage owned in total is %{stairowned}%. These figures cannot be the same." - monthly_leasehold_charges: - not_zero: "Monthly leasehold charges cannot be £0 if the property has monthly charges." - equity: - under_min: "The minimum initial equity stake for this type of shared ownership sale is %{min_equity}%." - over_max: "The maximum initial equity stake is %{max_equity}%." - over_stairowned_minus_stairbought: "The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the %{buyer_owns} minus the percentage bought." - mortgage: "Mortgage value cannot be £0 if a mortgage was used for the purchase of this property." + mortgage_used: + year: "You must answer either ‘yes’ or ‘no’ to the question ‘was a mortgage used’ for the selected year." + staircasing: "You must answer either ‘yes’ or ‘no’ to the question ‘was a mortgage used’ for staircasing transactions." shared_ownership_deposit: "The %{mortgage_deposit_and_discount_error_fields} added together is %{mortgage_deposit_and_discount_total}. The value times the equity percentage is %{value_times_equity}. These figures should be the same." household: diff --git a/config/locales/validations/sales/financial.en.yml b/config/locales/validations/sales/financial.en.yml new file mode 100644 index 000000000..efd257ea5 --- /dev/null +++ b/config/locales/validations/sales/financial.en.yml @@ -0,0 +1,81 @@ +en: + validations: + sales: + financial: + ownershipsch: + outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." + outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." + combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." + combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." + + uprn: + outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." + outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." + combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." + combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." + + la: + outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." + outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." + combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." + combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." + + postcode_full: + outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." + outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." + combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." + combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." + + income1: + outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." + outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." + combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." + combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." + + income2: + outside_london_income_range: "Income must be between £0 and £90,000 for properties within a London local authority." + outside_non_london_income_range: "Income must be between £0 and £80,000 for properties in a non-London local authority." + combined_over_hard_max_for_london: "Combined income must be £90,000 or lower for properties within a London local authority." + combined_over_hard_max_for_outside_london: "Combined income must be £80,000 or lower for properties outside London local authorities." + child_has_income: "Child's income must be £0." + + ecstat2: + child_has_income: "Child's income must be £0." + + mortgage: + mortgage_zero: "Mortgage value cannot be £0 if a mortgage was used for the purchase of this property." + + mscharge: + monthly_leasehold_charges: + not_zero: "Monthly leasehold charges cannot be £0 if the property has monthly charges." + + resale: + equity_over_max: "The maximum initial equity stake is %{max_equity}%." + + type: + equity_under_min: "The minimum initial equity stake for this type of shared ownership sale is %{min_equity}%." + equity_over_max: "The maximum initial equity stake is %{max_equity}%." + percentage_bought_must_be_at_least_threshold: "The minimum increase in equity while staircasing is %{threshold}% for this shared ownership type." + + equity: + equity_under_min: "The minimum initial equity stake for this type of shared ownership sale is %{min_equity}%." + equity_over_max: "The maximum initial equity stake is %{max_equity}%." + equity_over_stairowned_minus_stairbought: + joint_purchase: "The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyers own minus the percentage bought." + not_joint_purchase: "The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyer owns minus the percentage bought." + + stairowned: + equity_over_stairowned_minus_stairbought: + joint_purchase: "The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyers own minus the percentage bought." + not_joint_purchase: "The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyer owns minus the percentage bought." + percentage_bought_must_be_greater_than_percentage_owned: + joint_purchase: "Total percentage buyers now own must be more than percentage bought in this transaction." + not_joint_purchase: "Total percentage buyer now owns must be more than percentage bought in this transaction." + percentage_bought_equal_percentage_owned: "The percentage bought is %{stairbought}% and the percentage owned in total is %{stairowned}%. These figures cannot be the same." + + stairbought: + equity_over_stairowned_minus_stairbought: + joint_purchase: "The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyers own minus the percentage bought." + not_joint_purchase: "The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyer owns minus the percentage bought." + percentage_bought_must_be_at_least_threshold: "The minimum increase in equity while staircasing is %{threshold}%." + percentage_bought_equal_percentage_owned: "The percentage bought is %{stairbought}% and the percentage owned in total is %{stairowned}%. These figures cannot be the same." diff --git a/spec/models/validations/sales/financial_validations_spec.rb b/spec/models/validations/sales/financial_validations_spec.rb index b0e80303a..7b7749003 100644 --- a/spec/models/validations/sales/financial_validations_spec.rb +++ b/spec/models/validations/sales/financial_validations_spec.rb @@ -16,19 +16,19 @@ RSpec.describe Validations::Sales::FinancialValidations do it "adds errors if buyer 1 has income over 80,000" do record.income1 = 85_000 financial_validator.validate_income1(record) - expect(record.errors["income1"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) + expect(record.errors["income1"]).to include(match I18n.t("validations.sales.financial.income1.outside_non_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_non_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_non_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_non_london_income_range")) end it "adds errors if buyer 2 has income over 80,000" do record.income2 = 85_000 financial_validator.validate_income2(record) - expect(record.errors["income2"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) + expect(record.errors["income2"]).to include(match I18n.t("validations.sales.financial.income2.outside_non_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_non_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_non_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_non_london_income_range")) end it "does not add errors if buyer 1 has income above 0 and below 80_000" do @@ -46,27 +46,27 @@ RSpec.describe Validations::Sales::FinancialValidations do it "adds errors if buyer 1 has income below 0" do record.income1 = -500 financial_validator.validate_income1(record) - expect(record.errors["income1"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) + expect(record.errors["income1"]).to include(match I18n.t("validations.sales.financial.income1.outside_non_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_non_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_non_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_non_london_income_range")) end it "adds errors if buyer 2 has income below 0" do record.income2 = -5 financial_validator.validate_income2(record) - expect(record.errors["income2"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_non_london_income_range")) + expect(record.errors["income2"]).to include(match I18n.t("validations.sales.financial.income2.outside_non_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_non_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_non_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_non_london_income_range")) end it "adds errors when combined income is over 80_000" do record.income1 = 45_000 record.income2 = 40_000 financial_validator.validate_combined_income(record) - expect(record.errors["income1"]).to include(match I18n.t("validations.financial.income.combined_over_hard_max_for_outside_london")) - expect(record.errors["income2"]).to include(match I18n.t("validations.financial.income.combined_over_hard_max_for_outside_london")) + expect(record.errors["income1"]).to include(match I18n.t("validations.sales.financial.income1.combined_over_hard_max_for_outside_london")) + expect(record.errors["income2"]).to include(match I18n.t("validations.sales.financial.income2.combined_over_hard_max_for_outside_london")) end it "does not add errors when combined income is under 80_000" do @@ -85,19 +85,19 @@ RSpec.describe Validations::Sales::FinancialValidations do it "adds errors if buyer 1 has income over 90,000" do record.income1 = 95_000 financial_validator.validate_income1(record) - expect(record.errors["income1"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) + expect(record.errors["income1"]).to include(match I18n.t("validations.sales.financial.income1.outside_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_london_income_range")) end it "adds errors if buyer 2 has income over 90,000" do record.income2 = 95_000 financial_validator.validate_income2(record) - expect(record.errors["income2"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) + expect(record.errors["income2"]).to include(match I18n.t("validations.sales.financial.income2.outside_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_london_income_range")) end it "does not add errors if buyer 1 has income above 0 and below 90_000" do @@ -115,27 +115,27 @@ RSpec.describe Validations::Sales::FinancialValidations do it "adds errors if buyer 1 has income below 0" do record.income1 = -500 financial_validator.validate_income1(record) - expect(record.errors["income1"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) + expect(record.errors["income1"]).to include(match I18n.t("validations.sales.financial.income1.outside_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_london_income_range")) end it "adds errors if buyer 2 has income below 0" do record.income2 = -2 financial_validator.validate_income2(record) - expect(record.errors["income2"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["la"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) - expect(record.errors["postcode_full"]).to include(match I18n.t("validations.financial.income.outside_london_income_range")) + expect(record.errors["income2"]).to include(match I18n.t("validations.sales.financial.income2.outside_london_income_range")) + expect(record.errors["ownershipsch"]).to include(match I18n.t("validations.sales.financial.ownershipsch.outside_london_income_range")) + expect(record.errors["la"]).to include(match I18n.t("validations.sales.financial.la.outside_london_income_range")) + expect(record.errors["postcode_full"]).to include(match I18n.t("validations.sales.financial.postcode_full.outside_london_income_range")) end it "adds errors when combined income is over 90_000" do record.income1 = 55_000 record.income2 = 40_000 financial_validator.validate_combined_income(record) - expect(record.errors["income1"]).to include(match I18n.t("validations.financial.income.combined_over_hard_max_for_london")) - expect(record.errors["income2"]).to include(match I18n.t("validations.financial.income.combined_over_hard_max_for_london")) + expect(record.errors["income1"]).to include(match I18n.t("validations.sales.financial.income1.combined_over_hard_max_for_london")) + expect(record.errors["income2"]).to include(match I18n.t("validations.sales.financial.income2.combined_over_hard_max_for_london")) end it "does not add errors when combined income is under 90_000" do @@ -154,7 +154,7 @@ RSpec.describe Validations::Sales::FinancialValidations do record.mortgageused = 1 record.mortgage = 0 financial_validator.validate_mortgage(record) - expect(record.errors[:mortgage]).to include I18n.t("validations.financial.mortgage") + expect(record.errors[:mortgage]).to include I18n.t("validations.sales.financial.mortgage.mortgage_zero") end it "does not add an error is the mortgage is positive" do @@ -187,7 +187,7 @@ RSpec.describe Validations::Sales::FinancialValidations do record.stairowned = 40 record.jointpur = 1 financial_validator.validate_percentage_bought_not_greater_than_percentage_owned(record) - expect(record.errors["stairowned"]).to include("Total percentage buyers now own must be more than percentage bought in this transaction.") + expect(record.errors["stairowned"]).to include(I18n.t("validations.sales.financial.stairowned.percentage_bought_must_be_greater_than_percentage_owned.joint_purchase")) end it "adds an error to stairowned and not stairbought if the percentage bought is more than the percentage owned for non joint purchase" do @@ -195,7 +195,7 @@ RSpec.describe Validations::Sales::FinancialValidations do record.stairowned = 40 record.jointpur = 2 financial_validator.validate_percentage_bought_not_greater_than_percentage_owned(record) - expect(record.errors["stairowned"]).to include("Total percentage buyer now owns must be more than percentage bought in this transaction.") + expect(record.errors["stairowned"]).to include(I18n.t("validations.sales.financial.stairowned.percentage_bought_must_be_greater_than_percentage_owned.not_joint_purchase")) end end @@ -205,7 +205,6 @@ RSpec.describe Validations::Sales::FinancialValidations do context "with 24/25 logs" do before do record.saledate = Time.zone.local(2024, 4, 3) - record.save!(validate: false) end it "does not add an error if the percentage bought is less than the percentage owned" do @@ -219,8 +218,8 @@ RSpec.describe Validations::Sales::FinancialValidations do record.stairbought = 30 record.stairowned = 30 financial_validator.validate_percentage_bought_not_equal_percentage_owned(record) - expect(record.errors["stairowned"]).to include("The percentage bought is 30% and the percentage owned in total is 30%. These figures cannot be the same.") - expect(record.errors["stairbought"]).to include("The percentage bought is 30% and the percentage owned in total is 30%. These figures cannot be the same.") + expect(record.errors["stairowned"]).to eq([I18n.t("validations.sales.financial.stairowned.percentage_bought_equal_percentage_owned", stairbought: 30, stairowned: 30)]) + expect(record.errors["stairbought"]).to eq([I18n.t("validations.sales.financial.stairbought.percentage_bought_equal_percentage_owned", stairbought: 30, stairowned: 30)]) end it "does not add an error to stairowned and not stairbought if the percentage bought is more than the percentage owned" do @@ -234,7 +233,6 @@ RSpec.describe Validations::Sales::FinancialValidations do context "with 23/24 logs" do before do record.saledate = Time.zone.local(2023, 4, 3) - record.save!(validate: false) end it "does not add an error if the percentage bought is equal to the percentage owned" do @@ -258,7 +256,7 @@ RSpec.describe Validations::Sales::FinancialValidations do it "adds an error if monthly leasehold charges are zero" do record.mscharge = 0 financial_validator.validate_monthly_leasehold_charges(record) - expect(record.errors[:mscharge]).to include I18n.t("validations.financial.monthly_leasehold_charges.not_zero") + expect(record.errors[:mscharge]).to include I18n.t("validations.sales.financial.mscharge.monthly_leasehold_charges.not_zero") end end @@ -270,8 +268,8 @@ RSpec.describe Validations::Sales::FinancialValidations do [2, 16, 18, 24].each do |type| record.type = type financial_validator.validate_percentage_bought_at_least_threshold(record) - expect(record.errors["stairbought"]).to eq(["The minimum increase in equity while staircasing is 10%."]) - expect(record.errors["type"]).to eq(["The minimum increase in equity while staircasing is 10% for this shared ownership type."]) + expect(record.errors["stairbought"]).to eq([I18n.t("validations.sales.financial.stairbought.percentage_bought_must_be_at_least_threshold", threshold: 10)]) + expect(record.errors["type"]).to eq([I18n.t("validations.sales.financial.type.percentage_bought_must_be_at_least_threshold", threshold: 10)]) record.errors.clear end @@ -279,8 +277,8 @@ RSpec.describe Validations::Sales::FinancialValidations do [28, 30, 31, 32].each do |type| record.type = type financial_validator.validate_percentage_bought_at_least_threshold(record) - expect(record.errors["stairbought"]).to eq(["The minimum increase in equity while staircasing is 1%."]) - expect(record.errors["type"]).to eq(["The minimum increase in equity while staircasing is 1% for this shared ownership type."]) + expect(record.errors["stairbought"]).to eq([I18n.t("validations.sales.financial.stairbought.percentage_bought_must_be_at_least_threshold", threshold: 1)]) + expect(record.errors["type"]).to eq([I18n.t("validations.sales.financial.type.percentage_bought_must_be_at_least_threshold", threshold: 1)]) record.errors.clear end end @@ -331,8 +329,8 @@ RSpec.describe Validations::Sales::FinancialValidations do it "adds errors if buyer 2 has an income" do record.income2 = 40_000 financial_validator.validate_child_income(record) - expect(record.errors["ecstat2"]).to include(match I18n.t("validations.financial.income.child_has_income")) - expect(record.errors["income2"]).to include(match I18n.t("validations.financial.income.child_has_income")) + expect(record.errors["ecstat2"]).to include(match I18n.t("validations.sales.financial.ecstat2.child_has_income")) + expect(record.errors["income2"]).to include(match I18n.t("validations.sales.financial.income2.child_has_income")) end end end @@ -347,16 +345,16 @@ RSpec.describe Validations::Sales::FinancialValidations do record.type = 2 record.equity = 1 financial_validator.validate_equity_in_range_for_year_and_type(record) - expect(record.errors["equity"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 25)) - expect(record.errors["type"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 25)) + expect(record.errors["equity"]).to include(match I18n.t("validations.sales.financial.equity.equity_under_min", min_equity: 25)) + expect(record.errors["type"]).to include(match I18n.t("validations.sales.financial.type.equity_under_min", min_equity: 25)) end it "adds an error for type 30, equity below min with the correct percentage" do record.type = 30 record.equity = 1 financial_validator.validate_equity_in_range_for_year_and_type(record) - expect(record.errors["equity"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 10)) - expect(record.errors["type"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 10)) + expect(record.errors["equity"]).to include(match I18n.t("validations.sales.financial.equity.equity_under_min", min_equity: 10)) + expect(record.errors["type"]).to include(match I18n.t("validations.sales.financial.type.equity_under_min", min_equity: 10)) end it "does not add an error for equity in range with the correct percentage" do @@ -370,8 +368,8 @@ RSpec.describe Validations::Sales::FinancialValidations do record.type = 2 record.equity = 90 financial_validator.validate_equity_in_range_for_year_and_type(record) - expect(record.errors["equity"]).to include(match I18n.t("validations.financial.equity.over_max", max_equity: 75)) - expect(record.errors["type"]).to include(match I18n.t("validations.financial.equity.over_max", max_equity: 75)) + expect(record.errors["equity"]).to include(match I18n.t("validations.sales.financial.equity.equity_over_max", max_equity: 75)) + expect(record.errors["type"]).to include(match I18n.t("validations.sales.financial.type.equity_over_max", max_equity: 75)) end it "does not add an error if it's a resale" do @@ -390,16 +388,16 @@ RSpec.describe Validations::Sales::FinancialValidations do record.type = 2 record.equity = 1 financial_validator.validate_equity_in_range_for_year_and_type(record) - expect(record.errors["equity"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 25)) - expect(record.errors["type"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 25)) + expect(record.errors["equity"]).to include(match I18n.t("validations.sales.financial.equity.equity_under_min", min_equity: 25)) + expect(record.errors["type"]).to include(match I18n.t("validations.sales.financial.type.equity_under_min", min_equity: 25)) end it "adds an error for type 30, equity below min with the correct percentage" do record.type = 30 record.equity = 1 financial_validator.validate_equity_in_range_for_year_and_type(record) - expect(record.errors["equity"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 10)) - expect(record.errors["type"]).to include(match I18n.t("validations.financial.equity.under_min", min_equity: 10)) + expect(record.errors["equity"]).to include(match I18n.t("validations.sales.financial.equity.equity_under_min", min_equity: 10)) + expect(record.errors["type"]).to include(match I18n.t("validations.sales.financial.type.equity_under_min", min_equity: 10)) end it "does not add an error for equity in range with the correct percentage" do @@ -413,8 +411,8 @@ RSpec.describe Validations::Sales::FinancialValidations do record.type = 2 record.equity = 90 financial_validator.validate_equity_in_range_for_year_and_type(record) - expect(record.errors["equity"]).to include(match I18n.t("validations.financial.equity.over_max", max_equity: 75)) - expect(record.errors["type"]).to include(match I18n.t("validations.financial.equity.over_max", max_equity: 75)) + expect(record.errors["equity"]).to include(match I18n.t("validations.sales.financial.equity.equity_over_max", max_equity: 75)) + expect(record.errors["type"]).to include(match I18n.t("validations.sales.financial.type.equity_over_max", max_equity: 75)) end end end @@ -443,9 +441,9 @@ RSpec.describe Validations::Sales::FinancialValidations do record.equity = 2 record.jointpur = 1 financial_validator.validate_equity_less_than_staircase_difference(record) - expect(record.errors["equity"]).to include("The initial equity stake is 2% and the percentage owned in total minus the percentage bought is 1%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyers own minus the percentage bought.") - expect(record.errors["stairowned"]).to include("The initial equity stake is 2% and the percentage owned in total minus the percentage bought is 1%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyers own minus the percentage bought.") - expect(record.errors["stairbought"]).to include("The initial equity stake is 2% and the percentage owned in total minus the percentage bought is 1%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyers own minus the percentage bought.") + expect(record.errors["equity"]).to include(I18n.t("validations.sales.financial.equity.equity_over_stairowned_minus_stairbought.joint_purchase", equity: 2, staircase_difference: 1)) + expect(record.errors["stairowned"]).to include(I18n.t("validations.sales.financial.stairowned.equity_over_stairowned_minus_stairbought.joint_purchase", equity: 2, staircase_difference: 1)) + expect(record.errors["stairbought"]).to include(I18n.t("validations.sales.financial.stairbought.equity_over_stairowned_minus_stairbought.joint_purchase", equity: 2, staircase_difference: 1)) end it "adds errors if equity is more than stairowned - stairbought for non joint purchase" do @@ -454,9 +452,9 @@ RSpec.describe Validations::Sales::FinancialValidations do record.equity = 2 record.jointpur = 2 financial_validator.validate_equity_less_than_staircase_difference(record) - expect(record.errors["equity"]).to include("The initial equity stake is 2% and the percentage owned in total minus the percentage bought is 1%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyer owns minus the percentage bought.") - expect(record.errors["stairowned"]).to include("The initial equity stake is 2% and the percentage owned in total minus the percentage bought is 1%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyer owns minus the percentage bought.") - expect(record.errors["stairbought"]).to include("The initial equity stake is 2% and the percentage owned in total minus the percentage bought is 1%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the buyer owns minus the percentage bought.") + expect(record.errors["equity"]).to include(I18n.t("validations.sales.financial.equity.equity_over_stairowned_minus_stairbought.not_joint_purchase", equity: 2, staircase_difference: 1)) + expect(record.errors["stairowned"]).to include(I18n.t("validations.sales.financial.stairowned.equity_over_stairowned_minus_stairbought.not_joint_purchase", equity: 2, staircase_difference: 1)) + expect(record.errors["stairbought"]).to include(I18n.t("validations.sales.financial.stairbought.equity_over_stairowned_minus_stairbought.not_joint_purchase", equity: 2, staircase_difference: 1)) end it "does not add errors if equity is less than stairowned - stairbought" do