From 343cc9cb9ab4b76a34777987b29d4055c82120ad Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 9 Sep 2021 12:56:43 +0100 Subject: [PATCH] . --- longs/templates/longs/exam_scores_user.html | 39 +++++++++++++++------ longs/urls.py | 5 +++ longs/views.py | 18 +++++++++- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/longs/templates/longs/exam_scores_user.html b/longs/templates/longs/exam_scores_user.html index 4a86cac3..59495b76 100644 --- a/longs/templates/longs/exam_scores_user.html +++ b/longs/templates/longs/exam_scores_user.html @@ -1,30 +1,47 @@ {% extends 'longs/base.html' %} {% block content %} +
+ Question 1 +
+
+
Answers:
+

Exam: {{ exam.name }}

Candidate: {{ cid }}

Scores:
Total mark: {{ total_score }} / {{max_score}}
Normalised score: {{normalised_score}}

Answers

-
    {% for a,b,c,d,e in answer_text %} -
  • Question {{forloop.counter}}
  • -
      -
    • Observation
      {{a}}
    • -
    • Interpretation
      {{b}}
    • -
    • Principle Diagnosis
      {{c}}
    • -
    • Differential Diagnosis
      {{d}}
    • -
    • Management
      {{e}}
    • +
        {% for a,b,c,d,e in answer_text %} +
      • Question {{forloop.counter}}
      • +
          +
        • Observation
          +
          {{a}}
          +
        • +
        • Interpretation
          +
          {{b}}
          +
        • +
        • Principle Diagnosis
          +
          {{c}}
          +
        • +
        • Differential Diagnosis
          +
          {{d}}
          +
        • +
        • Management
          +
          {{e}}
          +
        • +
        + {% endfor %}
      - {% endfor %} -
diff --git a/longs/urls.py b/longs/urls.py index 0295f549..3b4c83d6 100755 --- a/longs/urls.py +++ b/longs/urls.py @@ -61,6 +61,11 @@ urlpatterns = [ # path("all_questions/", views.all_questions, name="all_questions"), path("question//scrap", views.long_scrap, name="long_scrap"), path("question//delete", views.LongDelete.as_view(), name="long_delete"), + path( + "exam//review", + views.question_review, + name="question_review", + ), path("exam////mark", views.mark_answer, name="mark_answer"), path("exam///mark", views.mark, name="mark"), path("exam//mark", views.LongExamViews.mark_overview, name="mark_overview"), diff --git a/longs/views.py b/longs/views.py index d322c464..ceb06523 100755 --- a/longs/views.py +++ b/longs/views.py @@ -1142,4 +1142,20 @@ class SeriesImagesZipView(SuperuserRequiredMixin, BaseZipView): def get_files(self): series = LongSeries.objects.get(pk=self.kwargs['pk']) - return [i.image.file for i in series.images.all()] \ No newline at end of file + return [i.image.file for i in series.images.all()] + +def question_review(request, pk): + """ + Return a json representation of the question when the exam is active + """ + if request.is_ajax(): + exam = get_object_or_404(Exam, pk=pk) + + if not exam.publish_results: + raise Http404 + + question = exam.exam_questions.all()[int(request.POST["question_number"])] + + question_json = question.get_question_json(based=False) + return JsonResponse(question_json) + return JsonResponse({"status": "error"})