From 1b94bf6a9bbaef4cd4d472cffdc4f770c675c62a Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 17 Oct 2021 11:45:24 +0100 Subject: [PATCH] . --- anatomy/templates/anatomy/exam_overview.html | 2 +- generic/views.py | 16 ++++++++++++++-- longs/templates/longs/exam_overview.html | 10 +++++++++- rapids/templates/rapids/exam_overview.html | 15 ++++----------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/anatomy/templates/anatomy/exam_overview.html b/anatomy/templates/anatomy/exam_overview.html index d5d77646..0905baad 100644 --- a/anatomy/templates/anatomy/exam_overview.html +++ b/anatomy/templates/anatomy/exam_overview.html @@ -59,7 +59,7 @@ {% endfor %} {% if can_edit %} -

+

{% endif %}
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}), diff --git a/generic/views.py b/generic/views.py index eccd8bc0..609bbc8e 100644 --- a/generic/views.py +++ b/generic/views.py @@ -36,9 +36,9 @@ from longs.models import Exam as LongExam from anatomy.models import AnatomyQuestion as AnatomyQuestion from anatomy.models import Exam as AnatomyExam from sbas.models import Question as SbasQuestion -#from sbas.models import Exam as SbasExam +from sbas.models import Exam as SbasExam from physics.models import Question as PhysicsQuestion -#from physics.models import Exam as PhysicsExam +from physics.models import Exam as PhysicsExam from django.db.models import Case, When from django.conf import settings @@ -109,6 +109,12 @@ def generic_exam_json_edit(request): elif question_type == "anatomy": Exam = AnatomyExam Question = AnatomyQuestion + elif question_type == "physics": + Exam = PhysicsExam + Question = PhysicsQuestion + elif question_type == "sbas": + Exam = SbasExam + Question = SbasQuestion else: data = {"status": "error"} return JsonResponse(data, status=400) @@ -116,6 +122,12 @@ def generic_exam_json_edit(request): exam = get_object_or_404(Exam, pk=request.POST.get("exam_id")) + #if "exam_toggle_active" in request.POST: + # active = json.loads(request.POST.get("active")) + + # data = {"status": "success"} + # return JsonResponse(data, status=200) + if "add_exam_questions" in request.POST: question_ids = json.loads(request.POST.get("add_exam_questions")) #question_objects = Question.objects.filter(pk__in=question_ids) diff --git a/longs/templates/longs/exam_overview.html b/longs/templates/longs/exam_overview.html index 6f258700..b72688fa 100644 --- a/longs/templates/longs/exam_overview.html +++ b/longs/templates/longs/exam_overview.html @@ -74,7 +74,7 @@ {% if can_edit %} -

+

JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}), JSON creation id: {{exam.exam_json_id}} @@ -189,6 +189,14 @@ $(this).remove(); sortable('.sortable'); + $("#full-question-list li").each((n, el) => { + $(el).append($( + "" + ).click(() => { + el.remove(); + })); + }) + $("#full-question-list").append($("").click(() => { new_order = []; $("#full-question-list li").each((n, el) => { diff --git a/rapids/templates/rapids/exam_overview.html b/rapids/templates/rapids/exam_overview.html index f13569e5..0de30739 100644 --- a/rapids/templates/rapids/exam_overview.html +++ b/rapids/templates/rapids/exam_overview.html @@ -28,7 +28,7 @@
- Exam active: [When checked the exam will be available to take in the test system]
{% if exam.exam_mode %} @@ -72,7 +72,7 @@ {{ author }}, {% endfor %}
-

+

JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}), JSON creation id: {{exam.exam_json_id}} @@ -87,7 +87,8 @@