.
This commit is contained in:
@@ -27,8 +27,8 @@
|
|||||||
<div class="parent-help" title="Click to enable / disable the exam results">
|
<div class="parent-help" title="Click to enable / disable the exam results">
|
||||||
Publish results: <input type="checkbox" id="exam-publish-results-switch" {% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will be available to users on this site]</span>
|
Publish results: <input type="checkbox" id="exam-publish-results-switch" {% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will be available to users on this site]</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
<p><a href="{% url 'anatomy:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
<p><a href="{% url 'anatomy:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<ol id="full-question-list" class="sortable">
|
<ol id="full-question-list" class="sortable">
|
||||||
{% for question in questions.all %}
|
{% for question in questions.all %}
|
||||||
@@ -41,7 +41,10 @@
|
|||||||
<br />
|
<br />
|
||||||
{{ question.question_type }}: {{ question.get_primary_answer }}
|
{{ question.question_type }}: {{ question.get_primary_answer }}
|
||||||
<br />
|
<br />
|
||||||
Modality: {{ question.modality }}, <a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
Modality: {{ question.modality }},
|
||||||
|
{% if exam.exam_mode %}
|
||||||
|
<a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
||||||
|
{% endif %}
|
||||||
<span class="id"><a href="{% url 'anatomy:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
|
<span class="id"><a href="{% url 'anatomy:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
+5
-3
@@ -118,15 +118,17 @@ def generic_exam_json_edit(request):
|
|||||||
|
|
||||||
if "add_exam_questions" in request.POST:
|
if "add_exam_questions" in request.POST:
|
||||||
question_ids = json.loads(request.POST.get("add_exam_questions"))
|
question_ids = json.loads(request.POST.get("add_exam_questions"))
|
||||||
question_objects = Question.objects.filter(pk__in=question_ids)
|
#question_objects = Question.objects.filter(pk__in=question_ids)
|
||||||
|
|
||||||
|
add_count = 0
|
||||||
for i in question_ids:
|
for i in question_ids:
|
||||||
# We get an integrity error if we try to add an object that already exists
|
# We get an integrity error if we try to add an object that already exists
|
||||||
if not exam.exam_questions.filter(pk=i).exists():
|
if not exam.exam_questions.filter(pk=i).exists():
|
||||||
|
add_count += 1
|
||||||
exam.exam_questions.add(i)
|
exam.exam_questions.add(i)
|
||||||
#exam.exam_questions.add(question_objects)
|
|
||||||
exam.save()
|
exam.save()
|
||||||
data = {"status": "success"}
|
data = {"status": "success", "questions added" : add_count}
|
||||||
return JsonResponse(data, status=200)
|
return JsonResponse(data, status=200)
|
||||||
|
|
||||||
if "set_exam_order" in request.POST:
|
if "set_exam_order" in request.POST:
|
||||||
|
|||||||
Reference in New Issue
Block a user