Spaces:
Build error
Build error
update generators module
Browse files- scripts/quiz/generators.py +13 -16
scripts/quiz/generators.py
CHANGED
@@ -1,36 +1,33 @@
|
|
1 |
-
from .questions import
|
2 |
from .utils import get_next_level
|
3 |
|
4 |
|
5 |
-
def start_interactive_math(
|
6 |
if wrong_answers > 2:
|
7 |
wrong_answers = 0
|
8 |
-
|
9 |
level = get_next_level(level, False)
|
10 |
-
elif
|
11 |
-
|
12 |
wrong_answers = 0
|
13 |
level = get_next_level(level)
|
14 |
|
15 |
-
question_data =
|
16 |
question = question_data['question']
|
17 |
right_answer = question_data['answer']
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
-
numbers_group = [
|
22 |
-
|
23 |
-
times = question_data['times']
|
24 |
-
numbers_group.append(times)
|
25 |
-
|
26 |
-
data_to_return = {
|
27 |
"text": question,
|
28 |
"question_numbers": numbers_group,
|
29 |
"right_answer": right_answer,
|
30 |
-
'number_correct':
|
31 |
'number_incorrect': wrong_answers,
|
32 |
'level': level,
|
33 |
"hints_used": 0
|
34 |
}
|
35 |
-
return
|
36 |
|
|
|
1 |
+
from .questions import generate_question_data
|
2 |
from .utils import get_next_level
|
3 |
|
4 |
|
5 |
+
def start_interactive_math(right_answers=0, wrong_answers=0, level="easy"):
|
6 |
if wrong_answers > 2:
|
7 |
wrong_answers = 0
|
8 |
+
right_answers = 0
|
9 |
level = get_next_level(level, False)
|
10 |
+
elif right_answers > 2:
|
11 |
+
right_answers = 0
|
12 |
wrong_answers = 0
|
13 |
level = get_next_level(level)
|
14 |
|
15 |
+
question_data = generate_question_data(level)
|
16 |
question = question_data['question']
|
17 |
right_answer = question_data['answer']
|
18 |
+
cur_num = question_data['current_number']
|
19 |
+
ord_num = question_data['ordinal_number']
|
20 |
+
times = question_data['times']
|
21 |
|
22 |
+
numbers_group = [cur_num, ord_num, times]
|
23 |
+
output = {
|
|
|
|
|
|
|
|
|
24 |
"text": question,
|
25 |
"question_numbers": numbers_group,
|
26 |
"right_answer": right_answer,
|
27 |
+
'number_correct': right_answers,
|
28 |
'number_incorrect': wrong_answers,
|
29 |
'level': level,
|
30 |
"hints_used": 0
|
31 |
}
|
32 |
+
return output
|
33 |
|