Browse Source

CLDC-1980: reduce number of questions changed to first per section

pull/3172/head
Nat Dean-Lewis 1 week ago
parent
commit
26cb47ee6e
  1. 1
      app/models/form/sales/questions/deposit_value_check.rb
  2. 1
      app/models/form/sales/questions/prevown.rb
  3. 1
      app/models/form/sales/questions/prevshared.rb
  4. 1
      app/models/form/sales/questions/savings.rb
  5. 1
      app/models/form/sales/questions/savings_nk.rb
  6. 1
      app/models/form/sales/questions/savings_value_check.rb
  7. 8
      spec/models/form/sales/questions/deposit_value_check_spec.rb
  8. 20
      spec/models/form/sales/questions/prevown_spec.rb
  9. 20
      spec/models/form/sales/questions/prevshared_spec.rb
  10. 20
      spec/models/form/sales/questions/savings_nk_spec.rb
  11. 20
      spec/models/form/sales/questions/savings_spec.rb
  12. 8
      spec/models/form/sales/questions/savings_value_check_spec.rb

1
app/models/form/sales/questions/deposit_value_check.rb

@ -19,6 +19,5 @@ class Form::Sales::Questions::DepositValueCheck < ::Form::Question
],
}
@check_answers_card_number = 0 unless form.start_year_2026_or_later?
@check_answers_card_title = "All buyers" if form.start_year_2026_or_later?
end
end

1
app/models/form/sales/questions/prevown.rb

@ -5,7 +5,6 @@ class Form::Sales::Questions::Prevown < ::Form::Question
@copy_key = "sales.income_benefits_and_savings.prevown.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_title = "All buyers" if form.start_year_2026_or_later?
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

1
app/models/form/sales/questions/prevshared.rb

@ -4,7 +4,6 @@ class Form::Sales::Questions::Prevshared < ::Form::Question
@id = "prevshared"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_title = "All buyers" if form.start_year_2026_or_later?
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

1
app/models/form/sales/questions/savings.rb

@ -8,7 +8,6 @@ class Form::Sales::Questions::Savings < ::Form::Question
@prefix = "£"
@step = 10
@min = 0
@check_answers_card_title = "All buyers" if form.start_year_2026_or_later?
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@strip_commas = true
end

1
app/models/form/sales/questions/savings_nk.rb

@ -5,7 +5,6 @@ class Form::Sales::Questions::SavingsNk < ::Form::Question
@copy_key = "sales.income_benefits_and_savings.savings.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}.savingsnk"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_title = "All buyers" if form.start_year_2026_or_later?
@conditional_for = {
"savings" => [0],
}

1
app/models/form/sales/questions/savings_value_check.rb

@ -19,6 +19,5 @@ class Form::Sales::Questions::SavingsValueCheck < ::Form::Question
],
}
@check_answers_card_number = 0 unless form.start_year_2026_or_later?
@check_answers_card_title = "All buyers" if form.start_year_2026_or_later?
end
end

8
spec/models/form/sales/questions/deposit_value_check_spec.rb

@ -39,10 +39,6 @@ RSpec.describe Form::Sales::Questions::DepositValueCheck, type: :model do
it "has check_answers_card_number set to 0" do
expect(question.check_answers_card_number).to eq(0)
end
it "does not have a check_answers_card_title" do
expect(question.check_answers_card_title).to be_nil
end
end
context "when in 2026", { year: 26 } do
@ -53,10 +49,6 @@ RSpec.describe Form::Sales::Questions::DepositValueCheck, type: :model do
it "does not have a check_answers_card_number" do
expect(question.check_answers_card_number).to be_nil
end
it "has check_answers_card_title set to 'All buyers'" do
expect(question.check_answers_card_title).to eq("All buyers")
end
end
it "has the correct answer_options" do

20
spec/models/form/sales/questions/prevown_spec.rb

@ -33,26 +33,6 @@ RSpec.describe Form::Sales::Questions::Prevown, type: :model do
expect(question.derived?(nil)).to be false
end
context "when in 2025", { year: 25 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(false)
end
it "does not have a check_answers_card_title" do
expect(question.check_answers_card_title).to be_nil
end
end
context "when in 2026", { year: 26 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(true)
end
it "has check_answers_card_title set to 'All buyers'" do
expect(question.check_answers_card_title).to eq("All buyers")
end
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Yes" },

20
spec/models/form/sales/questions/prevshared_spec.rb

@ -32,26 +32,6 @@ RSpec.describe Form::Sales::Questions::Prevshared, type: :model do
expect(question.derived?(nil)).to be false
end
context "when in 2025", { year: 25 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(false)
end
it "does not have a check_answers_card_title" do
expect(question.check_answers_card_title).to be_nil
end
end
context "when in 2026", { year: 26 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(true)
end
it "has check_answers_card_title set to 'All buyers'" do
expect(question.check_answers_card_title).to eq("All buyers")
end
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Yes" },

20
spec/models/form/sales/questions/savings_nk_spec.rb

@ -32,26 +32,6 @@ RSpec.describe Form::Sales::Questions::SavingsNk, type: :model do
expect(question.derived?(nil)).to be false
end
context "when in 2025", { year: 25 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(false)
end
it "does not have a check_answers_card_title" do
expect(question.check_answers_card_title).to be_nil
end
end
context "when in 2026", { year: 26 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(true)
end
it "has check_answers_card_title set to 'All buyers'" do
expect(question.check_answers_card_title).to eq("All buyers")
end
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"0" => { "value" => "Yes" },

20
spec/models/form/sales/questions/savings_spec.rb

@ -32,26 +32,6 @@ RSpec.describe Form::Sales::Questions::Savings, type: :model do
expect(question.derived?(nil)).to be false
end
context "when in 2025", { year: 25 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(false)
end
it "does not have a check_answers_card_title" do
expect(question.check_answers_card_title).to be_nil
end
end
context "when in 2026", { year: 26 } do
before do
allow(form).to receive(:start_year_2026_or_later?).and_return(true)
end
it "has check_answers_card_title set to 'All buyers'" do
expect(question.check_answers_card_title).to eq("All buyers")
end
end
it "has the correct width" do
expect(question.width).to eq(5)
end

8
spec/models/form/sales/questions/savings_value_check_spec.rb

@ -39,10 +39,6 @@ RSpec.describe Form::Sales::Questions::SavingsValueCheck, type: :model do
it "has check_answers_card_number set to 0" do
expect(question.check_answers_card_number).to eq(0)
end
it "does not have a check_answers_card_title" do
expect(question.check_answers_card_title).to be_nil
end
end
context "when in 2026", { year: 26 } do
@ -53,10 +49,6 @@ RSpec.describe Form::Sales::Questions::SavingsValueCheck, type: :model do
it "does not have a check_answers_card_number" do
expect(question.check_answers_card_number).to be_nil
end
it "has check_answers_card_title set to 'All buyers'" do
expect(question.check_answers_card_title).to eq("All buyers")
end
end
it "has the correct answer_options" do

Loading…
Cancel
Save