vladyslav
commited on
Commit
·
491af5b
1
Parent(s):
7887bc1
Saving grade in DB
Browse files- app.py +7 -6
- utils/db.py +3 -1
app.py
CHANGED
@@ -148,6 +148,11 @@ def summarize_results(student_name,
|
|
148 |
"answer": answer
|
149 |
})
|
150 |
|
|
|
|
|
|
|
|
|
|
|
151 |
save_results(
|
152 |
student_name,
|
153 |
class_name,
|
@@ -158,14 +163,10 @@ def summarize_results(student_name,
|
|
158 |
rating,
|
159 |
question_correct,
|
160 |
answers_correct,
|
161 |
-
interesting_question
|
|
|
162 |
)
|
163 |
|
164 |
-
correct_answers_count = sum(1 for answer in answers_log if answer['isCorrect'])
|
165 |
-
total_questions = len(questions_data)
|
166 |
-
|
167 |
-
grade_12 = (correct_answers_count / total_questions) * 12
|
168 |
-
|
169 |
summary = (
|
170 |
f"# Усі питання пройдено!\n\n"
|
171 |
f"## Ви відповіли правильно на {correct_answers_count} з {total_questions} питань.\n\n"
|
|
|
148 |
"answer": answer
|
149 |
})
|
150 |
|
151 |
+
correct_answers_count = sum(1 for answer in answers_log if answer['isCorrect'])
|
152 |
+
total_questions = len(questions_data)
|
153 |
+
|
154 |
+
grade_12 = (correct_answers_count / total_questions) * 12
|
155 |
+
|
156 |
save_results(
|
157 |
student_name,
|
158 |
class_name,
|
|
|
163 |
rating,
|
164 |
question_correct,
|
165 |
answers_correct,
|
166 |
+
interesting_question,
|
167 |
+
grade_12,
|
168 |
)
|
169 |
|
|
|
|
|
|
|
|
|
|
|
170 |
summary = (
|
171 |
f"# Усі питання пройдено!\n\n"
|
172 |
f"## Ви відповіли правильно на {correct_answers_count} з {total_questions} питань.\n\n"
|
utils/db.py
CHANGED
@@ -33,7 +33,8 @@ def save_results(student_name,
|
|
33 |
rating,
|
34 |
question_correct,
|
35 |
answers_correct,
|
36 |
-
interesting_question
|
|
|
37 |
print("Saving results")
|
38 |
collection.insert_one({
|
39 |
"student_name": student_name,
|
@@ -46,6 +47,7 @@ def save_results(student_name,
|
|
46 |
"interesting_question": interesting_question,
|
47 |
"feedback": feedback,
|
48 |
"rating": rating,
|
|
|
49 |
"created_at": db.command("serverStatus")["localTime"]
|
50 |
})
|
51 |
print("Saved results")
|
|
|
33 |
rating,
|
34 |
question_correct,
|
35 |
answers_correct,
|
36 |
+
interesting_question,
|
37 |
+
grade):
|
38 |
print("Saving results")
|
39 |
collection.insert_one({
|
40 |
"student_name": student_name,
|
|
|
47 |
"interesting_question": interesting_question,
|
48 |
"feedback": feedback,
|
49 |
"rating": rating,
|
50 |
+
"grade": grade,
|
51 |
"created_at": db.command("serverStatus")["localTime"]
|
52 |
})
|
53 |
print("Saved results")
|