Browse Source

Keep old copy pre 2025

pull/3040/head
Manny Dinssa 1 month ago
parent
commit
807a331ba3
  1. 60
      app/models/form/lettings/questions/person_working_situation.rb
  2. 46
      app/models/form/lettings/questions/working_situation1.rb
  3. 6
      app/models/form/sales/questions/buyer1_working_situation.rb
  4. 6
      app/models/form/sales/questions/buyer2_working_situation.rb
  5. 6
      app/models/form/sales/questions/person_working_situation.rb
  6. 6
      spec/models/form/lettings/questions/person_working_situation_spec.rb
  7. 30
      spec/models/form/sales/questions/buyer1_working_situation_spec.rb
  8. 73
      spec/models/form/sales/questions/buyer2_working_situation_spec.rb
  9. 35
      spec/models/form/sales/questions/person_working_situation_spec.rb

60
app/models/form/lettings/questions/person_working_situation.rb

@ -10,25 +10,47 @@ class Form::Lettings::Questions::PersonWorkingSituation < ::Form::Question
end
def answer_options
{ "1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"7" => { "value" => "Full-time student" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"9" => {
"value" => "Child under 16",
"depends_on" => [
{ "age#{@person_index}_known" => 1 },
{ "age#{@person_index}_known" => nil },
{ "age#{@person_index}" => { "operator" => "<", "operand" => 16 } },
],
},
"0" => { "value" => "Other" },
"divider" => { "value" => true },
"10" => { "value" => "Person prefers not to say" } }
if form.start_year_2025_or_later?
{ "1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"7" => { "value" => "Full-time student" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"9" => {
"value" => "Child under 16",
"depends_on" => [
{ "age#{@person_index}_known" => 1 },
{ "age#{@person_index}_known" => nil },
{ "age#{@person_index}" => { "operator" => "<", "operand" => 16 } },
],
},
"0" => { "value" => "Other" },
"divider" => { "value" => true },
"10" => { "value" => "Person prefers not to say" } }
else
{ "1" => { "value" => "Full-time – 30 hours or more" },
"2" => { "value" => "Part-time – Less than 30 hours" },
"7" => { "value" => "Full-time student" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long term sick or disability" },
"5" => { "value" => "Retired" },
"9" => {
"value" => "Child under 16",
"depends_on" => [
{ "age#{@person_index}_known" => 1 },
{ "age#{@person_index}_known" => nil },
{ "age#{@person_index}" => { "operator" => "<", "operand" => 16 } },
],
},
"0" => { "value" => "Other" },
"divider" => { "value" => true },
"10" => { "value" => "Person prefers not to say" } }
end
end
def question_number

46
app/models/form/lettings/questions/working_situation1.rb

@ -4,23 +4,41 @@ class Form::Lettings::Questions::WorkingSituation1 < ::Form::Question
@id = "ecstat1"
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
@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" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"7" => { "value" => "Full-time student" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"divider" => { "value" => true },
"10" => { "value" => "Tenant prefers not to say" },
}.freeze
def answer_options
if form.start_year_2025_or_later?
{
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"7" => { "value" => "Full-time student" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"divider" => { "value" => true },
"10" => { "value" => "Tenant prefers not to say" },
}
else
{
"1" => { "value" => "Full-time – 30 hours or more" },
"2" => { "value" => "Part-time – Less than 30 hours" },
"7" => { "value" => "Full-time student" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long term sick or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"divider" => { "value" => true },
"10" => { "value" => "Tenant prefers not to say" },
}
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 37, 2024 => 36 }.freeze
end

6
app/models/form/sales/questions/buyer1_working_situation.rb

@ -30,12 +30,12 @@ class Form::Sales::Questions::Buyer1WorkingSituation < ::Form::Question
}.freeze
else
{
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"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 because of long-term sickness or disability" },
"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" },

6
app/models/form/sales/questions/buyer2_working_situation.rb

@ -36,12 +36,12 @@ class Form::Sales::Questions::Buyer2WorkingSituation < ::Form::Question
}.freeze
else
{
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"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 because of long-term sickness or disability" },
"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" },

6
app/models/form/sales/questions/person_working_situation.rb

@ -40,12 +40,12 @@ class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question
}
else
{
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"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 because of long-term sickness or disability" },
"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" },

6
spec/models/form/lettings/questions/person_working_situation_spec.rb

@ -4,9 +4,13 @@ RSpec.describe Form::Lettings::Questions::PersonWorkingSituation, type: :model d
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)))) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 4)))) }
let(:person_index) { 2 }
before do
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(true)
end
it "has correct page" do
expect(question.page).to eq(page)
end

30
spec/models/form/sales/questions/buyer1_working_situation_spec.rb

@ -24,21 +24,6 @@ RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do
expect(question.derived?(nil)).to be false
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"10" => { "value" => "Buyer prefers not to say" },
"7" => { "value" => "Full-time student" },
})
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) }
@ -53,6 +38,21 @@ RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do
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
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"10" => { "value" => "Buyer prefers not to say" },
"7" => { "value" => "Full-time student" },
})
end
end
it "has the correct check_answers_card_number" do

73
spec/models/form/sales/questions/buyer2_working_situation_spec.rb

@ -26,32 +26,32 @@ RSpec.describe Form::Sales::Questions::Buyer2WorkingSituation, type: :model do
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"10" => { "value" => "Buyer prefers not to say" },
"7" => { "value" => "Full-time student" },
"9" => { "value" => "Child under 16" },
"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" },
"9" => { "value" => "Child under 16" },
})
end
it "has the correct displayed_answer_options" do
expect(question.displayed_answer_options(nil)).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"10" => { "value" => "Buyer prefers not to say" },
"7" => { "value" => "Full-time student" },
"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" },
})
end
@ -77,6 +77,37 @@ RSpec.describe Form::Sales::Questions::Buyer2WorkingSituation, type: :model do
it "uses the new ordering for displayed answer options" do
expect(question.displayed_answer_options(nil).keys).to eq(%w[1 2 3 4 5 6 7 8 0 10])
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"10" => { "value" => "Buyer prefers not to say" },
"7" => { "value" => "Full-time student" },
"9" => { "value" => "Child under 16" },
})
end
it "has the correct displayed_answer_options" do
expect(question.displayed_answer_options(nil)).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness or disability" },
"5" => { "value" => "Retired" },
"0" => { "value" => "Other" },
"10" => { "value" => "Buyer prefers not to say" },
"7" => { "value" => "Full-time student" },
})
end
end
it "has the correct check_answers_card_number" do

35
spec/models/form/sales/questions/person_working_situation_spec.rb

@ -23,22 +23,22 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"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 because of long-term sickness or disability" },
"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) } },
{ "age2_known" => 1 },
{ "age2_known" => nil },
{ "age2" => { "operator" => "<", "operand" => 16 } }] },
[{ "saledate" => { "operator" => "<", "operand" => Time.zone.local(2024, 4, 1) } },
{ "age2_known" => 1 },
{ "age2_known" => nil },
{ "age2" => { "operator" => "<", "operand" => 16 } }] },
})
end
@ -56,6 +56,27 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do
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
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Full-time – 30 hours or more per week" },
"2" => { "value" => "Part-time – Less than 30 hours per week" },
"3" => { "value" => "In government training into work" },
"4" => { "value" => "Jobseeker" },
"6" => { "value" => "Not seeking work" },
"8" => { "value" => "Unable to work because of long-term sickness 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) } },
{ "age2_known" => 1 },
{ "age2_known" => nil },
{ "age2" => { "operator" => "<", "operand" => 16 } }] },
})
end
end
context "when person 2" do

Loading…
Cancel
Save