Repository navigation
Expand file tree
/
Copy pathtowing_rules_flow.rb
More file actions
307 lines (272 loc) · 7.34 KB
/
Copy pathtowing_rules_flow.rb
File metadata and controls
307 lines (272 loc) · 7.34 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
class TowingRulesFlow < SmartAnswer::Flow
def define
content_id "7bab842c-a9aa-4369-b162-4e3e2a475245"
name "towing-rules"
status :published
## Cars and light vehicles
##
## Q1
radio :towing_vehicle_type? do
option "car-or-light-vehicle"
option "medium-sized-vehicle"
option "large-vehicle"
option "minibus"
option "bus"
next_node do |response|
case response
when "car-or-light-vehicle"
question :existing_towing_entitlements? # Q2
when "medium-sized-vehicle"
question :medium_sized_vehicle_licenceholder? # Q8
when "large-vehicle"
question :existing_large_vehicle_licence? # Q20
when "minibus"
question :car_licence_before_jan_1997? # Q25
when "bus"
question :bus_licenceholder? # Q36
end
end
end
## Q2
radio :existing_towing_entitlements? do
option :yes
option :no
next_node do |response|
case response
when "yes"
question :how_long_entitlements? # Q2A
when "no"
question :date_licence_was_issued? # Q5
end
end
end
## Q2A
radio :how_long_entitlements? do
option "before-19-Jan-2013"
option "after-19-Jan-2013"
next_node do |response|
case response
when "before-19-Jan-2013"
outcome :car_light_vehicle_entitlement # A3
when "after-19-Jan-2013"
outcome :full_entitlement # A4
end
end
end
## Q5
radio :date_licence_was_issued? do
option "licence-issued-before-19-Jan-2013"
option "licence-issued-after-19-Jan-2013"
next_node do |response|
case response
when "licence-issued-before-19-Jan-2013"
outcome :limited_trailer_entitlement_before_1997 # A6
when "licence-issued-after-19-Jan-2013"
outcome :limited_trailer_entitlement_after_1997 # A7
end
end
end
## Medium sized vehicles
##
## Q8
radio :medium_sized_vehicle_licenceholder? do
option :yes
option :no
next_node do |response|
case response
when "yes"
question :how_old_are_you_msv? # Q9
when "no"
question :existing_large_vehicle_towing_entitlements? # Q12
end
end
end
## Q9
radio :how_old_are_you_msv? do
option "under-21"
option "21-or-over"
next_node do |response|
case response
when "under-21"
outcome :limited_conditional_trailer_entitlement_msv # A10
when "21-or-over"
outcome :limited_trailer_entitlement_msv # A11
end
end
end
## Q12
radio :existing_large_vehicle_towing_entitlements? do
option :yes
option :no
next_node do |response|
case response
when "yes"
outcome :included_entitlement_msv # A13
when "no"
question :date_licence_was_issued_msv? # Q14
end
end
end
## Q14
radio :date_licence_was_issued_msv? do
option "before-jan-1997"
option "from-jan-1997"
next_node do |response|
case response
when "before-jan-1997"
outcome :full_entitlement_msv # A15
when "from-jan-1997"
question :how_old_are_you_msv_2? # Q16
end
end
end
## Q16
radio :how_old_are_you_msv_2? do
option "under-18"
option "under-21"
option "21-or-over"
next_node do |response|
case response
when "under-18"
outcome :too_young_msv # A17
when "under-21"
outcome :apply_for_provisional_with_exceptions_msv # A18
when "21-or-over"
outcome :apply_for_provisional_msv # 19
end
end
end
## Large vehicles
##
## Q20
radio :existing_large_vehicle_licence? do
option :yes
option :no
next_node do |response|
case response
when "yes"
outcome :full_cat_c_entitlement # A21
when "no"
question :how_old_are_you_lv? # Q22
end
end
end
## Q22
radio :how_old_are_you_lv? do
option "under-21"
option "21-or-over"
next_node do |response|
case response
when "under-21"
outcome :not_old_enough_lv # A23
when "21-or-over"
outcome :apply_for_provisional_lv # A24
end
end
end
## Minibuses
##
## Q25
radio :car_licence_before_jan_1997? do
option :yes
option :no
next_node do |response|
case response
when "yes"
outcome :full_entitlement_minibus # A26
when "no"
question :do_you_have_lv_or_bus_towing_entitlement? # Q27
end
end
end
## Q27
radio :do_you_have_lv_or_bus_towing_entitlement? do
option :yes
option :no
next_node do |response|
case response
when "yes"
outcome :included_entitlement_minibus # A28
when "no"
question :full_minibus_licence? # Q29
end
end
end
## Q29
radio :full_minibus_licence? do
option :yes
option :no
next_node do |response|
case response
when "yes"
outcome :limited_towing_entitlement_minibus # A30
when "no"
question :how_old_are_you_minibus? # Q31
end
end
end
## Q31
radio :how_old_are_you_minibus? do
option "under-21"
option "21-or-over"
next_node do |response|
case response
when "under-21"
outcome :not_old_enough_minibus # A32
when "21-or-over"
outcome :limited_overall_entitlement_minibus # A34
end
end
end
## Buses
##
## Q36
radio :bus_licenceholder? do
option :yes
option :no
next_node do |response|
case response
when "yes"
outcome :full_entitlement_bus # A37
when "no"
question :how_old_are_you_bus? # Q38
end
end
end
## Q38
radio :how_old_are_you_bus? do
option "under-21"
option "21-or-over"
next_node do |response|
case response
when "under-21"
outcome :not_old_enough_bus # A39
when "21-or-over"
outcome :apply_for_provisional_bus # A40
end
end
end
outcome :car_light_vehicle_entitlement # A3
outcome :full_entitlement # A4
outcome :limited_trailer_entitlement_before_1997 # A6
outcome :limited_trailer_entitlement_after_1997 # A7
outcome :limited_conditional_trailer_entitlement_msv # A10
outcome :limited_trailer_entitlement_msv # A11
outcome :included_entitlement_msv # A13
outcome :full_entitlement_msv # A15
outcome :too_young_msv # A17
outcome :apply_for_provisional_with_exceptions_msv # A18
outcome :apply_for_provisional_msv # A19
outcome :full_cat_c_entitlement # A21
outcome :not_old_enough_lv # A23
outcome :apply_for_provisional_lv # A24
outcome :full_entitlement_minibus # A26
outcome :included_entitlement_minibus # A28
outcome :limited_towing_entitlement_minibus # A30
outcome :not_old_enough_minibus # A32
outcome :limited_overall_entitlement_minibus # A34
outcome :full_entitlement_bus # A37
outcome :not_old_enough_bus # A39
outcome :apply_for_provisional_bus # A40
end
end