Browse Source
* change percent to % so that suffix is consistent with other similar questions * fix rebase conflicts * add hard validation that percentage owned after a staircasing transaction cannot be less than the percentage bought in that transaction, with associated tests * add compound validation to ensure that logs of type older person shared ownership may not have a stairbought value of greater than 75% \n associated tests included * remove duplicate method and use existing version * fix rebase conflicts * ensure schema correct and test of page number correct * fix form handler test after rebase * fix tests and ensure schema correct after rebasepull/1244/head v0.2.36
Arthur Campbell
2 years ago
committed by
GitHub
17 changed files with 173 additions and 11 deletions
@ -0,0 +1,27 @@
|
||||
class Form::Sales::Pages::StaircaseBoughtValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "staircase_bought_value_check" |
||||
@depends_on = [ |
||||
{ |
||||
"staircase_bought_above_fifty?" => true, |
||||
}, |
||||
] |
||||
@title_text = { |
||||
"translation" => "soft_validations.staircase_bought_seems_high", |
||||
"arguments" => [ |
||||
{ |
||||
"key" => "stairbought", |
||||
"i18n_template" => "percentage", |
||||
}, |
||||
], |
||||
} |
||||
@informative_text = {} |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::StaircaseBoughtValueCheck.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,23 @@
|
||||
class Form::Sales::Questions::StaircaseBoughtValueCheck < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "staircase_bought_value_check" |
||||
@check_answer_label = "Percentage bought 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" => [ |
||||
{ |
||||
"staircase_bought_value_check" => 0, |
||||
}, |
||||
{ |
||||
"staircase_bought_value_check" => 1, |
||||
}, |
||||
], |
||||
} |
||||
end |
||||
end |
@ -0,0 +1,5 @@
|
||||
class AddStaircaseBoughtValueCheckToSalesLog < ActiveRecord::Migration[7.0] |
||||
def change |
||||
add_column :sales_logs, :staircase_bought_value_check, :integer |
||||
end |
||||
end |
Loading…
Reference in new issue