From 00ff19c27b449385a3430c2dd3d0b3aeca939238 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 27 Feb 2023 08:52:05 +0000 Subject: [PATCH] Number remaining sale information questions --- app/models/form/sales/pages/about_deposit_with_discount.rb | 2 +- .../form/sales/pages/about_deposit_without_discount.rb | 7 ++++--- app/models/form/sales/pages/leasehold_charges.rb | 7 ++++++- app/models/form/sales/questions/deposit_amount.rb | 6 +++--- app/models/form/sales/questions/leasehold_charges_known.rb | 6 +++--- .../form/sales/subsections/discounted_ownership_scheme.rb | 4 ++-- app/models/form/sales/subsections/outright_sale.rb | 4 ++-- .../form/sales/subsections/shared_ownership_scheme.rb | 4 ++-- .../sales/pages/about_deposit_without_discount_spec.rb | 3 ++- spec/models/form/sales/pages/leasehold_charges_spec.rb | 3 ++- spec/models/form/sales/questions/deposit_amount_spec.rb | 5 +++-- .../form/sales/questions/leasehold_charges_known_spec.rb | 5 +++-- 12 files changed, 33 insertions(+), 23 deletions(-) diff --git a/app/models/form/sales/pages/about_deposit_with_discount.rb b/app/models/form/sales/pages/about_deposit_with_discount.rb index 6a4a54071..9d59accc5 100644 --- a/app/models/form/sales/pages/about_deposit_with_discount.rb +++ b/app/models/form/sales/pages/about_deposit_with_discount.rb @@ -8,7 +8,7 @@ class Form::Sales::Pages::AboutDepositWithDiscount < ::Form::Page def questions @questions ||= [ - Form::Sales::Questions::DepositAmount.new(nil, nil, self), + Form::Sales::Questions::DepositAmount.new(nil, nil, self, question_number: "Q95"), Form::Sales::Questions::DepositDiscount.new(nil, nil, self), ] end diff --git a/app/models/form/sales/pages/about_deposit_without_discount.rb b/app/models/form/sales/pages/about_deposit_without_discount.rb index e8e387eba..6d880bcb6 100644 --- a/app/models/form/sales/pages/about_deposit_without_discount.rb +++ b/app/models/form/sales/pages/about_deposit_without_discount.rb @@ -1,15 +1,16 @@ class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page - def initialize(id, hsh, subsection) - super + def initialize(id, hsh, subsection, question_number:) + super(id, hsh, subsection) @header = "About the deposit" @depends_on = [{ "is_type_discount?" => false, "ownershipsch" => 1 }, { "ownershipsch" => 2 }, { "ownershipsch" => 3, "mortgageused" => 1 }] + @question_number = question_number end def questions @questions ||= [ - Form::Sales::Questions::DepositAmount.new(nil, nil, self), + Form::Sales::Questions::DepositAmount.new(nil, nil, self, question_number: @question_number), ] end end diff --git a/app/models/form/sales/pages/leasehold_charges.rb b/app/models/form/sales/pages/leasehold_charges.rb index 93382cf18..4148d07a9 100644 --- a/app/models/form/sales/pages/leasehold_charges.rb +++ b/app/models/form/sales/pages/leasehold_charges.rb @@ -1,7 +1,12 @@ class Form::Sales::Pages::LeaseholdCharges < ::Form::Page + def initialize(id, hsh, subsection, question_number:) + super(id, hsh, subsection) + @question_number = question_number + end + def questions @questions ||= [ - Form::Sales::Questions::LeaseholdChargesKnown.new(nil, nil, self), + Form::Sales::Questions::LeaseholdChargesKnown.new(nil, nil, self, question_number: @question_number), Form::Sales::Questions::LeaseholdCharges.new(nil, nil, self), ] end diff --git a/app/models/form/sales/questions/deposit_amount.rb b/app/models/form/sales/questions/deposit_amount.rb index e4fd4ceb2..b0ff6012d 100644 --- a/app/models/form/sales/questions/deposit_amount.rb +++ b/app/models/form/sales/questions/deposit_amount.rb @@ -1,9 +1,9 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question - def initialize(id, hsh, page) - super + def initialize(id, hsh, page, question_number:) + super(id, hsh, page) @id = "deposit" @check_answer_label = "Cash deposit" - @header = "How much cash deposit was paid on the property?" + @header = "#{question_number} - How much cash deposit was paid on the property?" @type = "numeric" @min = 0 @width = 5 diff --git a/app/models/form/sales/questions/leasehold_charges_known.rb b/app/models/form/sales/questions/leasehold_charges_known.rb index 2c28e1814..519585a66 100644 --- a/app/models/form/sales/questions/leasehold_charges_known.rb +++ b/app/models/form/sales/questions/leasehold_charges_known.rb @@ -1,9 +1,9 @@ class Form::Sales::Questions::LeaseholdChargesKnown < ::Form::Question - def initialize(id, hsh, page) - super + def initialize(id, hsh, page, question_number:) + super(id, hsh, page) @id = "mscharge_known" @check_answer_label = "Monthly leasehold charges known?" - @header = "Does the property have any monthly leasehold charges?" + @header = "#{question_number} - Does the property have any monthly leasehold charges?" @hint_text = "For example, service and management charges" @type = "radio" @answer_options = ANSWER_OPTIONS diff --git a/app/models/form/sales/subsections/discounted_ownership_scheme.rb b/app/models/form/sales/subsections/discounted_ownership_scheme.rb index f277fc5ec..9745f6eb9 100644 --- a/app/models/form/sales/subsections/discounted_ownership_scheme.rb +++ b/app/models/form/sales/subsections/discounted_ownership_scheme.rb @@ -27,11 +27,11 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection Form::Sales::Pages::MortgageLength.new("mortgage_length_discounted_ownership", nil, self, question_number: "Q106"), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_discounted_ownership", nil, self, question_number: "Q107"), Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_value_check", nil, self), - Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self), + Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self, question_number: "Q108"), Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_value_check", nil, self), Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_deposit", nil, self), - Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_discounted_ownership", nil, self), + Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_discounted_ownership", nil, self, question_number: "Q109"), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_discounted_ownership_value_check", nil, self), ] end diff --git a/app/models/form/sales/subsections/outright_sale.rb b/app/models/form/sales/subsections/outright_sale.rb index 8e80e13df..7f26253be 100644 --- a/app/models/form/sales/subsections/outright_sale.rb +++ b/app/models/form/sales/subsections/outright_sale.rb @@ -18,9 +18,9 @@ class Form::Sales::Subsections::OutrightSale < ::Form::Subsection Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_outright_sale", nil, self), Form::Sales::Pages::MortgageLength.new("mortgage_length_outright_sale", nil, self, question_number: "Q114"), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_outright_sale", nil, self, question_number: "Q115"), - Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self), + Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self, question_number: "Q116"), Form::Sales::Pages::DepositValueCheck.new("outright_sale_deposit_value_check", nil, self), - Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_outright_sale", nil, self), + Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_outright_sale", nil, self, question_number: "Q117"), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_outright_sale_value_check", nil, self), ] end diff --git a/app/models/form/sales/subsections/shared_ownership_scheme.rb b/app/models/form/sales/subsections/shared_ownership_scheme.rb index f4e7129ab..edd21ede3 100644 --- a/app/models/form/sales/subsections/shared_ownership_scheme.rb +++ b/app/models/form/sales/subsections/shared_ownership_scheme.rb @@ -34,11 +34,11 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection Form::Sales::Pages::MortgageLength.new("mortgage_length_shared_ownership", nil, self, question_number: "Q93"), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_shared_ownership", nil, self, question_number: "Q94"), Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self), - Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self), + Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self, question_number: "Q95"), Form::Sales::Pages::DepositValueCheck.new("deposit_value_check", nil, self), 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), + Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_shared_ownership", nil, self, question_number: "Q98"), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_shared_ownership_value_check", nil, self), ] end diff --git a/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb b/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb index 62212e011..5d2059bab 100644 --- a/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb +++ b/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb @@ -1,10 +1,11 @@ require "rails_helper" RSpec.describe Form::Sales::Pages::AboutDepositWithoutDiscount, type: :model do - subject(:page) { described_class.new(page_id, page_definition, subsection) } + subject(:page) { described_class.new(page_id, page_definition, subsection, question_number:) } let(:page_id) { nil } let(:page_definition) { nil } + let(:question_number) { "Q95" } let(:subsection) { instance_double(Form::Subsection) } it "has correct subsection" do diff --git a/spec/models/form/sales/pages/leasehold_charges_spec.rb b/spec/models/form/sales/pages/leasehold_charges_spec.rb index c729bc82e..4957ed103 100644 --- a/spec/models/form/sales/pages/leasehold_charges_spec.rb +++ b/spec/models/form/sales/pages/leasehold_charges_spec.rb @@ -1,10 +1,11 @@ require "rails_helper" RSpec.describe Form::Sales::Pages::LeaseholdCharges, type: :model do - subject(:page) { described_class.new(page_id, page_definition, subsection) } + subject(:page) { described_class.new(page_id, page_definition, subsection, question_number:) } let(:page_id) { nil } let(:page_definition) { nil } + let(:question_number) { "Q45" } let(:subsection) { instance_double(Form::Subsection) } it "has correct subsection" do diff --git a/spec/models/form/sales/questions/deposit_amount_spec.rb b/spec/models/form/sales/questions/deposit_amount_spec.rb index 33a5dcf1d..8e884a7e8 100644 --- a/spec/models/form/sales/questions/deposit_amount_spec.rb +++ b/spec/models/form/sales/questions/deposit_amount_spec.rb @@ -1,10 +1,11 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::DepositAmount, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page) } + subject(:question) { described_class.new(question_id, question_definition, page, question_number:) } let(:question_id) { nil } let(:question_definition) { nil } + let(:question_number) { "Q109" } let(:page) { instance_double(Form::Page) } it "has correct page" do @@ -16,7 +17,7 @@ RSpec.describe Form::Sales::Questions::DepositAmount, type: :model do end it "has the correct header" do - expect(question.header).to eq("How much cash deposit was paid on the property?") + expect(question.header).to eq("Q109 - How much cash deposit was paid on the property?") end it "has the correct check_answer_label" do diff --git a/spec/models/form/sales/questions/leasehold_charges_known_spec.rb b/spec/models/form/sales/questions/leasehold_charges_known_spec.rb index d47b535eb..b9ecc470e 100644 --- a/spec/models/form/sales/questions/leasehold_charges_known_spec.rb +++ b/spec/models/form/sales/questions/leasehold_charges_known_spec.rb @@ -1,10 +1,11 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::LeaseholdChargesKnown, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page) } + subject(:question) { described_class.new(question_id, question_definition, page, question_number:) } let(:question_id) { nil } let(:question_definition) { nil } + let(:question_number) { "Q96" } let(:page) { instance_double(Form::Page) } it "has correct page" do @@ -16,7 +17,7 @@ RSpec.describe Form::Sales::Questions::LeaseholdChargesKnown, type: :model do end it "has the correct header" do - expect(question.header).to eq("Does the property have any monthly leasehold charges?") + expect(question.header).to eq("Q96 - Does the property have any monthly leasehold charges?") end it "has the correct check_answer_label" do