Browse Source

Number remaining sale information questions

CLDC-1864-question-numbering
Kat 2 years ago
parent
commit
00ff19c27b
  1. 2
      app/models/form/sales/pages/about_deposit_with_discount.rb
  2. 7
      app/models/form/sales/pages/about_deposit_without_discount.rb
  3. 7
      app/models/form/sales/pages/leasehold_charges.rb
  4. 6
      app/models/form/sales/questions/deposit_amount.rb
  5. 6
      app/models/form/sales/questions/leasehold_charges_known.rb
  6. 4
      app/models/form/sales/subsections/discounted_ownership_scheme.rb
  7. 4
      app/models/form/sales/subsections/outright_sale.rb
  8. 4
      app/models/form/sales/subsections/shared_ownership_scheme.rb
  9. 3
      spec/models/form/sales/pages/about_deposit_without_discount_spec.rb
  10. 3
      spec/models/form/sales/pages/leasehold_charges_spec.rb
  11. 5
      spec/models/form/sales/questions/deposit_amount_spec.rb
  12. 5
      spec/models/form/sales/questions/leasehold_charges_known_spec.rb

2
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

7
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

7
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

6
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

6
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

4
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

4
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

4
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

3
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

3
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

5
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

5
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

Loading…
Cancel
Save