elkay: quiz.py
Browse files- phase/Student_view/quiz.py +12 -10
phase/Student_view/quiz.py
CHANGED
|
@@ -18,16 +18,18 @@ def _get_quiz_from_source(quiz_id: int):
|
|
| 18 |
# backend: expose GET /quizzes/{quiz_id}
|
| 19 |
return api.get_quiz(quiz_id)
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
# backend: POST /quizzes/submit (or your route of choice)
|
| 32 |
return api.submit_quiz(student_id=student_id,
|
| 33 |
assignment_id=assignment_id,
|
|
|
|
| 18 |
# backend: expose GET /quizzes/{quiz_id}
|
| 19 |
return api.get_quiz(quiz_id)
|
| 20 |
|
| 21 |
+
# phase/Student_view/quiz.py
|
| 22 |
+
def _submit_quiz_result(*, student_id: int, assignment_id: int, quiz_id: int,
|
| 23 |
+
score: int, total: int, answers: dict):
|
| 24 |
+
# answers -> goes to DB as 'details'
|
| 25 |
+
return api.submit_quiz(
|
| 26 |
+
student_id=student_id,
|
| 27 |
+
assignment_id=assignment_id,
|
| 28 |
+
quiz_id=quiz_id,
|
| 29 |
+
score=score,
|
| 30 |
+
total=total,
|
| 31 |
+
details=answers,
|
| 32 |
+
)
|
| 33 |
# backend: POST /quizzes/submit (or your route of choice)
|
| 34 |
return api.submit_quiz(student_id=student_id,
|
| 35 |
assignment_id=assignment_id,
|