.
This commit is contained in:
@@ -15,7 +15,14 @@
|
||||
{% if not next_unmarked_id and not unmarked %}
|
||||
<div class="alert alert-info" role="alert">Success! Marking question complete. <br/>Return to <a href="{% url 'longs:mark' exam.id question_details.current|add:'-1' %}">question
|
||||
overview</a>, <a href="{% url 'longs:mark_overview' pk=exam.pk %}">marking
|
||||
overview</a></div>
|
||||
overview</a><br/>
|
||||
{% if previous_cid %}
|
||||
<a href="{% url 'longs:mark_answer' pk=exam.pk sk=question_details.current cid=previous_cid %}">Previous candidate</a>
|
||||
{% endif %}
|
||||
{% if next_cid %}
|
||||
<a href="{% url 'longs:mark_answer' pk=exam.pk sk=question_details.current cid=next_cid %}">Next candidate</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<span>Marking CID: {{answer.cid}} ({{unmarked|length}} answer(s) left to mark)</span>
|
||||
|
||||
+14
-1
@@ -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,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user