This commit is contained in:
Ross
2021-12-11 13:01:40 +00:00
parent 1f474c262e
commit a628bd59b2
5 changed files with 67 additions and 2 deletions
+7 -1
View File
@@ -315,13 +315,19 @@ def exam_finish(request, pk, cid):
)
def exam_take(request, pk, sk, cid):
def exam_take(request, pk, sk, cid, passcode=None):
exam = get_object_or_404(Exam, pk=pk)
if not exam.active:
raise Http404("Exam not found")
if exam.valid_users is not None:
user = exam.valid_users.filter(cid=cid)
if not user or user.passcode != passcode:
raise Http404("Exam not found")
question = exam.exam_questions.all()[sk]
exam_length = len(exam.exam_questions.all())