-
Notifications
You must be signed in to change notification settings - Fork 0
/
state_machine.py
281 lines (277 loc) · 9.88 KB
/
state_machine.py
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
# for mail
# state "vocabulary_export_favorite","vocabulary_export_favorite_email","vocabulary_export_favorite_email_complete",
# transition
# {
# "trigger": "advance",
# "source": "vocabulary",
# "dest": "vocabulary_export_favorite",
# "conditions": "is_going_to_vocabulary_export_favorite",
# },
# {
# "trigger": "advance",
# "source": "vocabulary_export_favorite",
# "dest": "vocabulary_export_favorite_email",
# "conditions": "is_going_to_vocabulary_export_favorite_email",
# },
# {
# "trigger": "advance",
# "source": "vocabulary_export_favorite_email",
# "dest": "vocabulary_export_favorite_email_complete",
# "conditions": "is_going_to_vocabulary_export_favorite_email_complete",
# },
# {"trigger": "go_back_vocabulary",
# "source": ["vocabulary_n2", "vocabulary_n3", "vocabulary_n4", "vocabulary_n5", "vocabulary_favorite",
# "vocabulary_export_favorite_email_complete"], "dest": "vocabulary"},
machine_diagram_states = ["user", "vocabulary", "vocabulary_n2", "vocabulary_n3", "vocabulary_n4", "vocabulary_n5",
"vocabulary_favorite", "vocabulary_add_favorite",
"vocabulary_delete_favorite", "vocabulary_test", "vocabulary_test_type",
"vocabulary_test_type_level_2", "vocabulary_test_type_level_3",
"vocabulary_test_type_level_4", "vocabulary_test_type_level_5",
"vocabulary_test_type_level_2_answer", "vocabulary_test_type_level_3_answer",
"vocabulary_test_type_level_4_answer", "vocabulary_test_type_level_5_answer"]
machine_diagram_transitions = [
{
"trigger": "advance",
"source": "user",
"dest": "vocabulary",
"conditions": "is_going_to_vocabulary",
},
{
"trigger": "advance",
"source": "vocabulary",
"dest": "vocabulary_n2",
"conditions": "is_going_to_vocabulary_n2",
},
{
"trigger": "advance",
"source": "vocabulary",
"dest": "vocabulary_n3",
"conditions": "is_going_to_vocabulary_n3",
},
{
"trigger": "advance",
"source": "vocabulary",
"dest": "vocabulary_n4",
"conditions": "is_going_to_vocabulary_n4",
},
{
"trigger": "advance",
"source": "vocabulary",
"dest": "vocabulary_n5",
"conditions": "is_going_to_vocabulary_n5",
},
{
"trigger": "advance",
"source": "vocabulary_n2",
"dest": "vocabulary_n2",
"conditions": "is_going_to_vocabulary_n2",
},
{
"trigger": "advance",
"source": "vocabulary_n3",
"dest": "vocabulary_n3",
"conditions": "is_going_to_vocabulary_n3",
},
{
"trigger": "advance",
"source": "vocabulary_n4",
"dest": "vocabulary_n4",
"conditions": "is_going_to_vocabulary_n4",
},
{
"trigger": "advance",
"source": "vocabulary_n5",
"dest": "vocabulary_n5",
"conditions": "is_going_to_vocabulary_n5",
},
{
"trigger": "advance",
"source": "vocabulary_n2",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_n3",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_n4",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_n5",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{
"trigger": "advance",
"source": "vocabulary",
"dest": "vocabulary_favorite",
"conditions": "is_going_to_vocabulary_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_favorite",
"dest": "vocabulary_favorite",
"conditions": "is_going_to_vocabulary_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_favorite",
"dest": "vocabulary_delete_favorite",
"conditions": "is_going_to_vocabulary_delete_favorite",
},
{
"trigger": "advance",
"source": "vocabulary",
"dest": "vocabulary_test",
"conditions": "is_going_to_vocabulary_test",
},
{
"trigger": "advance",
"source": "vocabulary_test",
"dest": "vocabulary_test_type",
"conditions": "is_going_to_vocabulary_test_type",
},
{
"trigger": "advance",
"source": "vocabulary_test_type",
"dest": "vocabulary_test_type_level_2",
"conditions": "is_going_to_vocabulary_test_type_level_2",
},
{
"trigger": "advance",
"source": "vocabulary_test_type",
"dest": "vocabulary_test_type_level_3",
"conditions": "is_going_to_vocabulary_test_type_level_3",
},
{
"trigger": "advance",
"source": "vocabulary_test_type",
"dest": "vocabulary_test_type_level_4",
"conditions": "is_going_to_vocabulary_test_type_level_4",
},
{
"trigger": "advance",
"source": "vocabulary_test_type",
"dest": "vocabulary_test_type_level_5",
"conditions": "is_going_to_vocabulary_test_type_level_5",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_2",
"dest": "vocabulary_test_type_level_2_answer",
"conditions": "is_going_to_vocabulary_test_type_level_2_answer",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_3",
"dest": "vocabulary_test_type_level_3_answer",
"conditions": "is_going_to_vocabulary_test_type_level_3_answer",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_4",
"dest": "vocabulary_test_type_level_4_answer",
"conditions": "is_going_to_vocabulary_test_type_level_4_answer",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_5",
"dest": "vocabulary_test_type_level_5_answer",
"conditions": "is_going_to_vocabulary_test_type_level_5_answer",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_2_answer",
"dest": "vocabulary_test_type_level_2",
"conditions": "is_going_to_vocabulary_test_type_level_2",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_3_answer",
"dest": "vocabulary_test_type_level_3",
"conditions": "is_going_to_vocabulary_test_type_level_3",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_4_answer",
"dest": "vocabulary_test_type_level_4",
"conditions": "is_going_to_vocabulary_test_type_level_4",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_5_answer",
"dest": "vocabulary_test_type_level_5",
"conditions": "is_going_to_vocabulary_test_type_level_5",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_2_answer",
"dest": "vocabulary",
"conditions": "is_going_to_vocabulary",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_2_answer",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_3_answer",
"dest": "vocabulary",
"conditions": "is_going_to_vocabulary",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_3_answer",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_4_answer",
"dest": "vocabulary",
"conditions": "is_going_to_vocabulary",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_4_answer",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_5_answer",
"dest": "vocabulary",
"conditions": "is_going_to_vocabulary",
},
{
"trigger": "advance",
"source": "vocabulary_test_type_level_5_answer",
"dest": "vocabulary_add_favorite",
"conditions": "is_going_to_vocabulary_add_favorite",
},
{"trigger": "go_back_vocabulary",
"source": ["vocabulary_n2", "vocabulary_n3", "vocabulary_n4", "vocabulary_n5", "vocabulary_favorite"],
"dest": "vocabulary"},
{"trigger": "go_back_vocabulary_test_type_level_2_answer", "source": ["vocabulary_add_favorite"],
"dest": "vocabulary_test_type_level_2_answer"},
{"trigger": "go_back_vocabulary_test_type_level_3_answer", "source": ["vocabulary_add_favorite"],
"dest": "vocabulary_test_type_level_3_answer"},
{"trigger": "go_back_vocabulary_test_type_level_4_answer", "source": ["vocabulary_add_favorite"],
"dest": "vocabulary_test_type_level_4_answer"},
{"trigger": "go_back_vocabulary_test_type_level_5_answer", "source": ["vocabulary_add_favorite"],
"dest": "vocabulary_test_type_level_5_answer"},
{"trigger": "go_back_vocabulary_n2", "source": ["vocabulary_add_favorite"], "dest": "vocabulary_n2"},
{"trigger": "go_back_vocabulary_n3", "source": ["vocabulary_add_favorite"], "dest": "vocabulary_n3"},
{"trigger": "go_back_vocabulary_n4", "source": ["vocabulary_add_favorite"], "dest": "vocabulary_n4"},
{"trigger": "go_back_vocabulary_n5", "source": ["vocabulary_add_favorite"], "dest": "vocabulary_n5"},
{"trigger": "go_back_favorite", "source": ["vocabulary_delete_favorite"], "dest": "vocabulary_favorite"},
]