From 4d078e7309a9c3bc0807ffaf4c41d6b21e72f3eb Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 11 Sep 2021 19:19:57 +0100 Subject: [PATCH] . --- longs/models.py | 8 ++++ .../longs/mark_question_double_overview.html | 45 +++++++++++++++++++ ...tml => mark_question_single_overview.html} | 0 longs/views.py | 35 ++++++++++----- 4 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 longs/templates/longs/mark_question_double_overview.html rename longs/templates/longs/{mark_question_overview.html => mark_question_single_overview.html} (100%) diff --git a/longs/models.py b/longs/models.py index fa20c4e4..e2fc4f7d 100644 --- a/longs/models.py +++ b/longs/models.py @@ -767,11 +767,19 @@ class CidUserAnswer(models.Model): else: return True + def get_mark_status(self): + mark_objects = self.mark.objects.all() + if not mark_objects: + return "Unmarked" + markers = ",".join([i.marker for i in mark_objects]) + return f"Marked by {markers}" + def get_answer_score(self): if self.score == "": return "" return float(self.score) + @reversion.register class AnswerMarks(models.Model): score = models.CharField( diff --git a/longs/templates/longs/mark_question_double_overview.html b/longs/templates/longs/mark_question_double_overview.html new file mode 100644 index 00000000..f03d313d --- /dev/null +++ b/longs/templates/longs/mark_question_double_overview.html @@ -0,0 +1,45 @@ +{% extends 'longs/exams.html' %} + +{% block content %} +View +Edit Admin + Edit +

Marking question {{question_details.current}} of {{question_details.total}}

+
+ + {% if not unmarked_count %} + + {% else %} + + + {% endif %} + Answers: + +
+ {% if question_details.current > 1 %} + Previous + {% endif %} + {% if question_details.current >= question_details.total %} + {% else %} + Next + {% endif %} +
+
+ +{% endblock %} \ No newline at end of file diff --git a/longs/templates/longs/mark_question_overview.html b/longs/templates/longs/mark_question_single_overview.html similarity index 100% rename from longs/templates/longs/mark_question_overview.html rename to longs/templates/longs/mark_question_single_overview.html diff --git a/longs/views.py b/longs/views.py index 2cb9cd84..f0dce060 100755 --- a/longs/views.py +++ b/longs/views.py @@ -781,17 +781,30 @@ def mark_question_overview(request, exam_id, sk): unmarked_count = user_answers.filter(score=CidUserAnswer.ScoreOptions.UNMARKED).count() - return render( - request, - "longs/mark_question_overview.html", - { - "exam": exam, - "question": question, - "question_details": question_details, - "user_answers": user_answers, - "unmarked_count": unmarked_count, - }, - ) + if exam.double_mark: + return render( + request, + "longs/mark_question_double_overview.html", + { + "exam": exam, + "question": question, + "question_details": question_details, + "user_answers": user_answers, + "unmarked_count": unmarked_count, + }, + ) + else: + return render( + request, + "longs/mark_question_single_overview.html", + { + "exam": exam, + "question": question, + "question_details": question_details, + "user_answers": user_answers, + "unmarked_count": unmarked_count, + }, + ) @login_required