diff --git a/rapids/models.py b/rapids/models.py
index 61b403c9..26bd7ef9 100644
--- a/rapids/models.py
+++ b/rapids/models.py
@@ -258,8 +258,9 @@ class Rapid(models.Model):
[i for i in user_answer_queryset if i.normal == False and i.answer_compare not in marked_answers]
)
- #unmarked_answers = user_answers - self.get_marked_answers()
-
+ return [i.answer_compare for i in unmarked_answers]
+
+ # Marker code below is not used
if marker is None:
return [i.answer_compare for i in unmarked_answers]
diff --git a/rapids/templates/rapids/mark.html b/rapids/templates/rapids/mark.html
index b2e7696a..247a4a30 100644
--- a/rapids/templates/rapids/mark.html
+++ b/rapids/templates/rapids/mark.html
@@ -43,32 +43,44 @@
{% endif %}
- Unmarked:
-
- {% for answer in user_answers %}
- -
-
{{ answer }}
-
- {% endfor %}
-
- Marked:
-
- {% for answer in correct_answers %}
- -
-
{{ answer }}
-
- {% endfor %}
- {% for answer in half_mark_answers %}
- -
-
{{ answer }}
-
- {% endfor %}
- {% for answer in incorrect_answers %}
- -
-
{{ answer }}
-
- {% endfor %}
-
+ {% if not review %}
+ Unmarked:
+
+ {% for answer in user_answers %}
+ -
+
{{ answer }}
+
+ {% endfor %}
+
+
+ Marked:
+
+ {% for answer in correct_answers %}
+ -
+
{{ answer }}
+
+ {% endfor %}
+ {% for answer in half_mark_answers %}
+ -
+
{{ answer }}
+
+ {% endfor %}
+ {% for answer in incorrect_answers %}
+ -
+
{{ answer }}
+
+ {% endfor %}
+
+ {% else %}
+ To review:
+
+ {% for answer, mark in review_user_answers %}
+ -
+
{{ answer }}
+
+ {% endfor %}
+
+ {% endif %}
Key: 2 Marks, 1
Mark, 0 Marks
diff --git a/rapids/views.py b/rapids/views.py
index 139ed639..564ffe7b 100755
--- a/rapids/views.py
+++ b/rapids/views.py
@@ -605,16 +605,6 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
except IndexError:
raise Http404("Exam question does not exist")
- answers_dict = {}
-
- for ans in question.answers.all():
- answers_dict[ans.answer_compare] = ans
-
-
- if unmarked_exam_answers_only:
- unmarked_user_answers = question.get_unmarked_user_answers(exam_pk=exam_pk)
- else:
- unmarked_user_answers = question.get_unmarked_user_answers()
if request.method == "POST":
@@ -667,15 +657,16 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
else:
form = MarkRapidQuestionForm()
- if unmarked_exam_answers_only:
- correct_answers = []
- half_mark_answers = []
- incorrect_answers = []
- else:
- correct_answers = question.answers.filter(status=Answer.MarkOptions.CORRECT)
- half_mark_answers = question.answers.filter(status=Answer.MarkOptions.HALF_MARK)
- incorrect_answers = question.answers.filter(status=Answer.MarkOptions.INCORRECT)
+ #answers_dict = {}
+ #for ans in question.answers.all():
+ # answers_dict[ans.answer_compare] = ans
+
+
+ correct_answers = []
+ half_mark_answers = []
+ incorrect_answers = []
+ review_user_answers = []
# this could be improved
if question.normal:
incorrect_answers = question.get_user_answers()
@@ -683,6 +674,31 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
incorrect_answers.remove("")
if "normal" in incorrect_answers:
incorrect_answers.remove("normal")
+ else:
+ if review:
+ unmarked_user_answers = question.get_user_answers(exam_pk=exam_pk)
+ elif unmarked_exam_answers_only:
+ unmarked_user_answers = question.get_unmarked_user_answers(exam_pk=exam_pk)
+ else:
+ unmarked_user_answers = question.get_unmarked_user_answers()
+
+
+ if not unmarked_exam_answers_only or review:
+ correct_answers = question.answers.filter(status=Answer.MarkOptions.CORRECT)
+ half_mark_answers = question.answers.filter(status=Answer.MarkOptions.HALF_MARK)
+ incorrect_answers = question.answers.filter(status=Answer.MarkOptions.INCORRECT)
+
+ if review:
+ for ans in unmarked_user_answers:
+ mark = "unmarked"
+ if ans in correct_answers:
+ mark = "correct"
+ elif ans in half_mark_answers:
+ mark = "half-mark"
+ elif ans in incorrect_answers:
+ mark = "incorrect"
+ review_user_answers.append(ans, mark)
+
return render(
request,
@@ -695,6 +711,7 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
"question_number": n,
"question_details": question_details,
"user_answers": unmarked_user_answers,
+ "review_user_answers": review_user_answers,
"correct_answers": correct_answers,
"half_mark_answers": half_mark_answers,
"incorrect_answers": incorrect_answers,