Browse Source

CLDC-3766: Ensure copy for Q78 is found correctly

pull/2790/head
Rachael Booth 7 months ago
parent
commit
8263e6539a
  1. 2
      app/models/form/sales/questions/staircase.rb
  2. 1
      app/models/form/sales/subsections/shared_ownership_scheme.rb
  3. 4
      app/models/form/subsection.rb

2
app/models/form/sales/questions/staircase.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::Staircase < ::Form::Question
def initialize(id, hsh, page)
super
@id = "staircase"
@copy_key = "sales.#{page.subsection.id}.staircasing"
@copy_key = "sales.#{page.subsection.copy_key}.staircasing"
@type = "radio"
@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/subsections/shared_ownership_scheme.rb

@ -4,6 +4,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
@id = "shared_ownership_scheme"
@label = "Shared ownership scheme"
@depends_on = [{ "ownershipsch" => 1, "setup_completed?" => true }]
@copy_key = "sale_information"
end
def pages

4
app/models/form/subsection.rb

@ -14,6 +14,10 @@ class Form::Subsection
delegate :form, to: :section
def copy_key
@copy_key ||= @id
end
def questions
@questions ||= pages.flat_map(&:questions)
end

Loading…
Cancel
Save