Browse Source
* CLDC-853 Added hard validations for sales income2 * CLDC-853 Added soft validation for sales income2 * CLDC-853 Fix tests broken by new code * CLDC-853 Add new tests for new page and refactor slightly * CLDC-853 Fix linting errors * CLDC-853 Rename migration and update schema version * CLDC-853 Fix broken sales income2 test * CLDC-853 Rename migration * CLDC-853 Move income 2 to cya card 2 and commonise combined income validation * CLDC-853 Actually use the validate_combined_income method * combine duplicate methods after rebase, ensure hard validations are triggered on all relevant fields * move validation on child income to financial validations to stop it being triggered on lettings logs, minor amendments to tests broken by changes * revamp financial validations tests against income to reflect updates * amend child income validation to reflect specifications and write tests to cover this validation * correct linting errors and play a little code golf * change copy for some validations, add sales log method and amend interruption screen helper to support this * extract duplicate code to private method * update buyer 1 and 2 income value check to be consistent * remove ecstat from income checks, the only ecstat we care about is child which is dealt with elsewhere * rename constant struct with same anme as existing variable * amend tests to reflect the chagnes in validations and copy * enable currency formatting of numbers for inserting into informative_text or title_text * update evil test in form handler spec * rebase and fix conflicts and tests * change a variable name and correct minor rebase errors * update interruption screen helper tests * correct linting errors, minor test failure and typo * add tests for new sales log method for formatting currency * fix merge conflicts --------- Co-authored-by: Arthur Campbell <arfa.camble@gmail.com>pull/1336/head
David May-Miller
2 years ago
committed by
GitHub
23 changed files with 420 additions and 128 deletions
@ -0,0 +1,35 @@
|
||||
class Form::Sales::Pages::Buyer2IncomeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ |
||||
"income2_under_soft_min?" => true, |
||||
}, |
||||
] |
||||
@title_text = { |
||||
"translation" => "soft_validations.income.under_soft_min_for_economic_status", |
||||
"arguments" => [ |
||||
{ |
||||
"key" => "field_formatted_as_currency", |
||||
"arguments_for_key" => "income2", |
||||
"i18n_template" => "income", |
||||
}, |
||||
{ |
||||
"key" => "income_soft_min_for_ecstat", |
||||
"arguments_for_key" => "ecstat2", |
||||
"i18n_template" => "minimum", |
||||
}, |
||||
], |
||||
} |
||||
@informative_text = {} |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Buyer2IncomeValueCheck.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,25 @@
|
||||
class Form::Sales::Questions::Buyer2IncomeValueCheck < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "income2_value_check" |
||||
@check_answer_label = "Income confirmation" |
||||
@header = "Are you sure this is correct?" |
||||
@type = "interruption_screen" |
||||
@answer_options = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
} |
||||
@hidden_in_check_answers = { |
||||
"depends_on" => [ |
||||
{ |
||||
"income2_value_check" => 0, |
||||
}, |
||||
{ |
||||
"income2_value_check" => 1, |
||||
}, |
||||
], |
||||
} |
||||
@check_answers_card_number = 2 |
||||
@page = page |
||||
end |
||||
end |
@ -0,0 +1,5 @@
|
||||
class AddIncome2ValueCheck < ActiveRecord::Migration[7.0] |
||||
def change |
||||
add_column :sales_logs, :income2_value_check, :integer |
||||
end |
||||
end |
Loading…
Reference in new issue