Repository navigation
Expand file tree
/
Copy pathstate_pension_through_partner_flow.rb
More file actions
111 lines (95 loc) · 3.33 KB
/
Copy pathstate_pension_through_partner_flow.rb
File metadata and controls
111 lines (95 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
class StatePensionThroughPartnerFlow < SmartAnswer::Flow
def define
content_id "42a41808-b338-4e4b-a703-47195982f4c8"
name "state-pension-through-partner"
status :published
# Q1
radio :what_is_your_marital_status? do
option :married
option :widowed
option :divorced
on_response do |response|
self.calculator = SmartAnswer::Calculators::StatePensionThroughPartnerCalculator.new
calculator.marital_status = response
end
next_node do
if calculator.divorced?
question :what_is_your_gender?
else
question :when_will_you_reach_pension_age?
end
end
end
# Q2
radio :when_will_you_reach_pension_age? do
option :your_pension_age_before_specific_date
option :your_pension_age_after_specific_date
on_response do |response|
calculator.when_will_you_reach_pension_age = response
end
next_node do
if calculator.widow_and_new_pension?
question :what_is_your_gender?
elsif calculator.widow_and_old_pension?
outcome :widow_and_old_pension_outcome
else
question :when_will_your_partner_reach_pension_age?
end
end
end
# Q3
radio :when_will_your_partner_reach_pension_age? do
option :partner_pension_age_before_specific_date
option :partner_pension_age_after_specific_date
on_response do |response|
calculator.when_will_your_partner_reach_pension_age = response
end
next_node do
if calculator.current_rules_no_additional_pension?
outcome :current_rules_no_additional_pension_outcome
elsif calculator.current_rules_national_insurance_no_state_pension?
outcome :current_rules_national_insurance_no_state_pension_outcome
else
question :what_is_your_gender?
end
end
end
# Q4
radio :what_is_your_gender? do
option :male_gender
option :female_gender
on_response do |response|
calculator.gender = response
end
next_node do
if calculator.male?
if calculator.divorced?
outcome :impossibility_due_to_divorce_outcome
elsif calculator.widowed?
outcome :widow_male_reaching_pension_age
else
outcome :impossibility_to_increase_pension_outcome
end
elsif calculator.female?
if calculator.divorced?
outcome :age_dependent_pension_outcome
elsif calculator.widowed?
outcome :married_woman_and_state_pension_outcome
else
outcome :married_woman_no_state_pension_outcome
end
end
end
end
# Outcome list below. NB: outcomes 4 and 7 are not available
outcome :current_rules_no_additional_pension_outcome # Outcome 1
outcome :widow_and_old_pension_outcome # Outcome 2
outcome :current_rules_national_insurance_no_state_pension_outcome # Outcome 3
outcome :married_woman_no_state_pension_outcome # Outcome 5
outcome :married_woman_and_state_pension_outcome # Outcome 6
outcome :impossibility_to_increase_pension_outcome # Outcome 8a
outcome :widow_male_reaching_pension_age # Outcome 8b
outcome :impossibility_due_to_divorce_outcome # Outcome 9
outcome :age_dependent_pension_outcome # Outcome 10
end
end