Browse Source
* CLDC-4168: Add check for mortgage length known * CLDC-4168: Add mortgage length known to question page * CLDC-4168: Make mortgage length conditional on interview requires a little changing to question logic to account for if the conditional question is not visible right now * CLDC-4168: Add R override to BU * CLDC-4168: Enforce mortlen is not R if buyer not interviewed in BU * CLDC-4168: Update tests * CLDC-4168: Add a lint task that autocorrects * CLDC-4168: Add mortgage length known to sales log factory * CLDC-4168: Allow mortgage not know if buyer wasn't interviewed previously had this the wrong way around. this makes sense because if you interviewed the buyer you should know this * CLDC-4168: Rename mortgage_length_known to mortlen_known matches the mortlen field * fixup! CLDC-4168: Add mortgage length known to question page remove old year numbers * fixup! CLDC-4168: Rename mortgage_length_known to mortlen_known * fixup! CLDC-4168: Allow mortgage not know if buyer wasn't interviewed missed test fix * CLDC-4168: Revert changes to outright_sale section * fixup! CLDC-4168: Revert changes to outright_sale section * fixup! CLDC-4168: Update tests * CLDC-4168: Allow for "r" in mortlenCLDC-4160-sentry-migration v0.6.3
20 changed files with 489 additions and 96 deletions
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Pages::MortgageLengthInterviewed < ::Form::Page |
||||
def initialize(id, hsh, subsection, ownershipsch:) |
||||
super(id, hsh, subsection) |
||||
@ownershipsch = ownershipsch |
||||
@depends_on = [{ |
||||
"mortgageused" => 1, "buyer_not_interviewed?" => false |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MortgageLength.new(nil, nil, self, ownershipsch: @ownershipsch), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,16 @@
|
||||
class Form::Sales::Pages::MortgageLengthNotInterviewed < ::Form::Page |
||||
def initialize(id, hsh, subsection, ownershipsch:) |
||||
super(id, hsh, subsection) |
||||
@ownershipsch = ownershipsch |
||||
@depends_on = [ |
||||
{ "mortgageused" => 1, "buyer_not_interviewed?" => true }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MortgageLengthKnown.new(nil, nil, self, ownershipsch: @ownershipsch), |
||||
Form::Sales::Questions::MortgageLength.new(nil, nil, self, ownershipsch: @ownershipsch), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,21 @@
|
||||
class Form::Sales::Questions::MortgageLengthKnown < ::Form::Question |
||||
def initialize(id, hsh, page, ownershipsch:) |
||||
super(id, hsh, page) |
||||
@id = "mortlen_known" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@conditional_for = { "mortlen" => [0] } |
||||
@hidden_in_check_answers = { |
||||
"depends_on" => [ |
||||
{ "mortlen_known" => 0 }, |
||||
], |
||||
} |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP = { |
||||
2026 => { 1 => 84, 2 => 108 }, |
||||
}.freeze |
||||
end |
||||
@ -0,0 +1,5 @@
|
||||
class AddMortlenKnownToSalesLogs < ActiveRecord::Migration[7.2] |
||||
def change |
||||
add_column :sales_logs, :mortlen_known, :integer |
||||
end |
||||
end |
||||
Loading…
Reference in new issue