Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Define permitted next nodes for all flows #2002

Closed
wants to merge 52 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f822077
Fail fast if next_node not in permitted_next_nodes
chrisroos Oct 12, 2015
564cfc6
Use permitted_next_nodes in additional-commodity-code
chrisroos Oct 12, 2015
a396dff
Update checksum data for additional-commodity-code
chrisroos Oct 12, 2015
e62601c
Use permitted_next_nodes in minimum-wage
chrisroos Oct 12, 2015
1e00d38
Update checksum data for minimum-wage
chrisroos Oct 12, 2015
390dfff
Use permitted_next_nodes in benefit-cap-calculator
chrisroos Oct 12, 2015
aa5b4de
Update checksum data for benefit-cap-calculator
chrisroos Oct 12, 2015
9f5bff4
Pass permitted_next_nodes to next_node
chrisroos Oct 13, 2015
3b494c3
Use permitted option in additional-commodity-code
chrisroos Oct 13, 2015
4eafdd5
Update checksum data for additional-commodity-code
chrisroos Oct 13, 2015
b8df92d
Use permitted option in minimum-wage
chrisroos Oct 13, 2015
70c2e88
Update checksum data for minimum-wage
chrisroos Oct 13, 2015
22e521e
Use permitted option in benefit-cap-calculator
chrisroos Oct 13, 2015
5beb0c0
Update checksum data for benefit-cap-calculator
chrisroos Oct 13, 2015
2fdeaa2
Use permitted option in redundancy-pay
chrisroos Oct 13, 2015
e36cd42
Use permitted option in calculate-married-couples-allowance
chrisroos Oct 13, 2015
fd15f5a
Update checksum data for calculate-married-couples-allowance
chrisroos Oct 13, 2015
abea785
Use permitted option in calculate-state-pension
chrisroos Oct 13, 2015
b189bbb
Update checksums for calculate-state-pension
chrisroos Oct 13, 2015
9fc65ad
Use permitted option in calculate-your-holiday-entitlement
chrisroos Oct 13, 2015
77f0711
Update checksum data for calculate-your-holiday-entitlement
chrisroos Oct 13, 2015
fc37c58
Use permitted option in check-uk-visa
chrisroos Oct 13, 2015
dc40b2f
Update checksum data for check-uk-visa
chrisroos Oct 13, 2015
0419fb0
Use permitted option in childcare-costs-for-tax-credits
chrisroos Oct 13, 2015
d33ad53
Update checksum data for childcare-costs-for-tax-credits
chrisroos Oct 13, 2015
df6f470
Use permitted option in estimate-self-assessment-penalties
chrisroos Oct 13, 2015
a7edc2c
Update checksum data for estimate-self-assessment-penalties
chrisroos Oct 13, 2015
b21acd0
Use permitted option in help-if-you-are-arrested-abroad
chrisroos Oct 13, 2015
5fe26bd
Update checksum data for help-if-you-are-arrested-abroad
chrisroos Oct 13, 2015
d63012e
Use permitted option in landlord-immigration-check
chrisroos Oct 13, 2015
b0805e0
Update checksum data for landlord-immigration-check
chrisroos Oct 13, 2015
5e46745
Use permitted option in part-year-profit-tax-credits
chrisroos Oct 13, 2015
10ced66
Use permitted option in pip-checker
chrisroos Oct 13, 2015
596008b
Update checksum data for pip-checker
chrisroos Oct 13, 2015
08a1c92
Use permitted option in report-a-lost-or-stolen-passport
chrisroos Oct 13, 2015
5667e60
Update checksum data for report-a-lost-or-stolen-passport
chrisroos Oct 13, 2015
7675785
Use permitted option in simplified-expenses-checker
chrisroos Oct 13, 2015
a2d8405
Update checksum data for simplified-expenses-checker
chrisroos Oct 13, 2015
67845f5
Use permitted option in student-finance-calculator
chrisroos Oct 13, 2015
34327e0
Update checksum data for student-finance-calculator
chrisroos Oct 13, 2015
1411df9
Use permitted option in graph test flow
chrisroos Oct 13, 2015
b80ab45
Use permitted option in missing_transition test flow
chrisroos Oct 13, 2015
f680161
Use permitted option in bridge-of-death test flow
chrisroos Oct 13, 2015
4406cd4
Use permitted option in checkbox-sample test flow
chrisroos Oct 13, 2015
3d17ecd
Use permitted option in custom-errors-sample test flow
chrisroos Oct 13, 2015
1692d08
Use permitted option in multiple_choice_question_test
chrisroos Oct 13, 2015
ecd72b8
Update graph_presenter_test
chrisroos Oct 13, 2015
b3865af
Fix Rubocop warning in calculate-married-couples-allowance
chrisroos Oct 13, 2015
ae5aaa8
Fix Rubocop warnings in minimum_wage.rb
chrisroos Oct 13, 2015
dd0fb80
Fix Rubocop warning in redundancy_pay.rb
chrisroos Oct 13, 2015
60df5b7
Update checksum data for minimum-wage Smart Answers
chrisroos Oct 13, 2015
05477a8
Update checksum data for calculate-married-couples-allowance
chrisroos Oct 13, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use permitted_next_nodes in benefit-cap-calculator
chrisroos committed Oct 12, 2015
commit 390dfffc221e620d4201c8e98b87723d26720f83
183 changes: 183 additions & 0 deletions lib/smart_answer_flows/benefit-cap-calculator.rb
Original file line number Diff line number Diff line change
@@ -13,6 +13,9 @@ def define

save_input_as :housing_benefit

permitted_next_nodes :working_tax_credit?,
:outcome_not_affected_no_housing_benefit

next_node do |response|
if response == 'yes'
:working_tax_credit?
@@ -27,6 +30,9 @@ def define
option :yes
option :no

permitted_next_nodes :outcome_not_affected_exemptions,
:receiving_exemption_benefits?

next_node do |response|
if response == 'yes'
:outcome_not_affected_exemptions
@@ -41,6 +47,9 @@ def define
option :yes
option :no

permitted_next_nodes :outcome_not_affected_exemptions,
:receiving_non_exemption_benefits?

next_node do |response|
if response == 'yes'
:outcome_not_affected_exemptions
@@ -84,6 +93,25 @@ def define
0
end

permitted_next_nodes :outcome_not_affected,
:bereavement_amount?,
:carers_amount?,
:child_benefit_amount?,
:child_tax_amount?,
:esa_amount?,
:guardian_amount?,
:incapacity_amount?,
:income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do |response|
first_value = response.split(",").first
if response == "none"
@@ -101,6 +129,23 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :carers_amount?,
:child_benefit_amount?,
:child_tax_amount?,
:esa_amount?,
:guardian_amount?,
:incapacity_amount?,
:income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -113,6 +158,22 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :child_benefit_amount?,
:child_tax_amount?,
:esa_amount?,
:guardian_amount?,
:incapacity_amount?,
:income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -125,6 +186,21 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :child_tax_amount?,
:esa_amount?,
:guardian_amount?,
:incapacity_amount?,
:income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -137,6 +213,20 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :esa_amount?,
:guardian_amount?,
:incapacity_amount?,
:income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -149,6 +239,19 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :guardian_amount?,
:incapacity_amount?,
:income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -161,6 +264,18 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :incapacity_amount?,
:income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -173,6 +288,17 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :income_support_amount?,
:jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -185,6 +311,16 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :jsa_amount?,
:maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -197,6 +333,15 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :maternity_amount?,
:sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -209,6 +354,14 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :sda_amount?,
:widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -221,6 +374,13 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :widowed_mother_amount?,
:widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -233,6 +393,12 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :widowed_parent_amount?,
:widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -245,6 +411,11 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :widow_pension_amount?,
:widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -257,6 +428,10 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :widows_aged_amount?,
:housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -269,6 +444,9 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :housing_benefit_amount?,
:single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -283,6 +461,8 @@ def define
total_benefits + response.to_f
end

permitted_next_nodes :single_couple_lone_parent?

next_node do
benefit_related_questions.shift
end
@@ -303,6 +483,9 @@ def define
sprintf("%.2f", benefit_cap)
end

permitted_next_nodes :outcome_affected_greater_than_cap,
:outcome_not_affected_less_than_cap

next_node do |response|
if response == 'single'
cap = 350