This commit is contained in:
Ross
2021-09-12 10:01:59 +01:00
parent f9fc597902
commit 239812b592
2 changed files with 17 additions and 2 deletions
+13 -1
View File
@@ -191,8 +191,20 @@ class Long(models.Model):
answers = self.cid_user_answers.all() answers = self.cid_user_answers.all()
else: else:
answers = self.cid_user_answers.filter(exam__id=exam_pk) answers = self.cid_user_answers.filter(exam__id=exam_pk)
unmarked_answers = [ans for ans in answers if not ans.is_marked()]
if marker is None:
return unmarked_answers
# If marker is specified we check for what they have marker
marker_unmarked = []
for answer in unmarked_answers:
if answer.mark.filter(marker=marker).count() < 1:
marker_unmarked.append(answer)
return [ans for ans in answers if not ans.is_marked()] return marker_unmarked
def get_question_json(self, based=True): def get_question_json(self, based=True):
# self == q? # self == q?
+4 -1
View File
@@ -671,7 +671,10 @@ def mark_answer(request, exam_id, question_number, cid):
previous_cid = cid_list[cid_list.index(cid)-1] previous_cid = cid_list[cid_list.index(cid)-1]
try: try:
unmarked = question.get_unmarked_answers(exam_pk=exam.id, marker=request.user) if exam.double_mark:
unmarked = question.get_unmarked_answers(exam_pk=exam.id, marker=request.user)
else:
unmarked = question.get_unmarked_answers(exam_pk=exam.id)
next_unmarked_id = unmarked[0].cid next_unmarked_id = unmarked[0].cid
if next_unmarked_id == cid: if next_unmarked_id == cid:
next_unmarked_id = unmarked[1].cid next_unmarked_id = unmarked[1].cid