From 56f74d6c2e5ed75d5d77bee7a12ce880e9223c37 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 8 Sep 2021 17:22:16 +0100 Subject: [PATCH] . --- longs/templates/longs/mark_answer.html | 9 ++++++++- longs/views.py | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/longs/templates/longs/mark_answer.html b/longs/templates/longs/mark_answer.html index 2a7f0e9f..f751ccbe 100644 --- a/longs/templates/longs/mark_answer.html +++ b/longs/templates/longs/mark_answer.html @@ -15,7 +15,14 @@ {% if not next_unmarked_id and not unmarked %} + overview
+ {% if previous_cid %} + Previous candidate + {% endif %} + {% if next_cid %} + Next candidate + {% endif %} + {% endif %} Marking CID: {{answer.cid}} ({{unmarked|length}} answer(s) left to mark) diff --git a/longs/views.py b/longs/views.py index d736e3ba..58d507f7 100755 --- a/longs/views.py +++ b/longs/views.py @@ -669,13 +669,24 @@ def mark_answer(request, pk, sk, cid): raise Http404("Exam question does not exist") - question.cid_user_answers.filter(exam__id=pk).values_list("cid", flat=True) + cid_list = question.cid_user_answers.filter(exam__id=pk).values_list("cid", flat=True) try: answer = question.cid_user_answers.get(cid=cid, exam__id=pk) except ObjectDoesNotExist: raise Http404("User answer does not exist") + previous_cid = False + next_cid = False + + if cid_list[0] == cid: + next_cid = cid_list[1] + elif cid_list[-1] == cid: + previous_cid = cid_list[-2] + else: + next_cid = cid_list[cid_list.index(cid)+1] + previous_cid = cid_list[cid_list.index(cid)-1] + try: unmarked = question.get_unmarked_answers() next_unmarked_id = unmarked[0].cid @@ -720,6 +731,8 @@ def mark_answer(request, pk, sk, cid): "question_details": question_details, "next_unmarked_id": next_unmarked_id, "unmarked": unmarked, + "previous_cid": previous_cid, + "next_cid": next_cid, }, )