Browse Source
* fix rebase conflicts * fix rebase conflicts * feat: update validation * fix rebase conflicts * fix rebase conflicts * test: update * fix rebase conflicts * fix rebase conflicts * fix rebase conflicts * fix rebase conflicts * fix rebase conflicts * implement before validation check to ensure that if the user declares no mortgage will be used, mortgage value is set to 0 * fix rebase conflicts * fix rebase conflicts * remove comment * fix rebase conflicts * Update config/locales/en.yml Co-authored-by: James Rose <james@jbpr.net> * alter order of before validation methods on sales log so that derived fields are calculated after invalidated dependent fields are cleared, fix tests broken by this change * add mortgage to derived variables so that mortgage value is set to 0 if a mortgage is not being used in the sale * remove hard validation of range for discount question and allow shared validation of numeric questions to handle this case * amend tests after rebasing * fix tests after rebasing * fix test and ensure schema correct after rebase --------- Co-authored-by: natdeanlewissoftwire <nat.dean-lewis@softwire.com> Co-authored-by: James Rose <james@jbpr.net>pull/1255/head
Arthur Campbell
2 years ago
committed by
GitHub
13 changed files with 154 additions and 23 deletions
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Pages::DepositAndMortgageValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@depends_on = [ |
||||
{ |
||||
"mortgage_plus_deposit_less_than_discounted_value?" => true, |
||||
}, |
||||
] |
||||
@informative_text = {} |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::DepositAndMortgageValueCheck.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,23 @@
|
||||
class Form::Sales::Questions::DepositAndMortgageValueCheck < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "deposit_and_mortgage_value_check" |
||||
@check_answer_label = "Deposit and mortgage against discount confirmation" |
||||
@header = "Are you sure? Mortgage and deposit usually equal or are more than (value - discount)" |
||||
@type = "interruption_screen" |
||||
@answer_options = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
} |
||||
@hidden_in_check_answers = { |
||||
"depends_on" => [ |
||||
{ |
||||
"deposit_and_mortgage_value_check" => 0, |
||||
}, |
||||
{ |
||||
"deposit_and_mortgage_value_check" => 1, |
||||
}, |
||||
], |
||||
} |
||||
end |
||||
end |
@ -0,0 +1,5 @@
|
||||
class AddDepositAndMortgageValueCheckToSalesLogs < ActiveRecord::Migration[7.0] |
||||
def change |
||||
add_column :sales_logs, :deposit_and_mortgage_value_check, :integer |
||||
end |
||||
end |
Loading…
Reference in new issue