.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.4 on 2021-08-01 08:47
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('rapids', '0026_exam_json_creation_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='exam',
|
||||
old_name='json_creation_id',
|
||||
new_name='exam_json_id',
|
||||
),
|
||||
]
|
||||
@@ -6,18 +6,22 @@
|
||||
<div class="rapids">
|
||||
<a href="{% url 'rapids:exam_update' exam.id %}" title="Edit the Exam">Edit</a>
|
||||
<a href="{% url 'rapids:exam_delete' exam.id %}" title="Delete the Exam">Delete</a>
|
||||
<a href="{% url 'admin:rapids_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
|
||||
<a href="{% url 'admin:rapids_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin
|
||||
Edit</a>
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br/>
|
||||
Normal {{ exam.get_normal_abnormal_breakdown }}<br/>
|
||||
Exam mode: {{ exam.exam_mode }}<br/>
|
||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
|
||||
Normal {{ exam.get_normal_abnormal_breakdown }}<br />
|
||||
Exam mode: {{ exam.exam_mode }}<br />
|
||||
|
||||
{% if exam.exam_mode %}
|
||||
<div class="parent-help" title="Click to enable / disable the exam">
|
||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span
|
||||
class="help-text">[When checked the exam will be available to take in the test system]</span>
|
||||
</div>
|
||||
<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 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 on this site]</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<p><a href="{% url 'rapids:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||
@@ -27,9 +31,9 @@
|
||||
|
||||
<li data-question_pk={{question.pk}}>
|
||||
<a href="{% url 'rapids:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
|
||||
{% for image in question.get_images %}
|
||||
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
||||
{% endfor %}
|
||||
{% for image in question.get_images %}
|
||||
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
|
||||
{% endfor %}
|
||||
</a>
|
||||
{% if not question.normal %}
|
||||
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
|
||||
@@ -39,7 +43,9 @@
|
||||
<b>Normal</b>
|
||||
{% endif %}
|
||||
<br />
|
||||
Examination: {{ question.get_examinations }}, <a href="{% url 'rapids:question_detail' pk=question.pk %}">View</a>, <a href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
||||
Examination: {{ question.get_examinations }}, <a
|
||||
href="{% url 'rapids:question_detail' pk=question.pk %}">View</a>, <a
|
||||
href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
@@ -49,6 +55,10 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p><button id='button-edit-order'>Edit exam order</button></p>
|
||||
<div>
|
||||
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
|
||||
JSON creation id: {{exam.exam_json_id}}
|
||||
</div>
|
||||
<a href="{% url 'rapids:exam_json' pk=exam.pk %}">JSON</a>
|
||||
<a href="{% url 'rapids:exam_json_unbased' pk=exam.pk %}">JSON (unbased)</a>
|
||||
<a href="{% url 'rapids:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
|
||||
@@ -61,20 +71,20 @@
|
||||
// send request to change the is_private state on customSwitches toggle
|
||||
$("#exam-active-switch").on("change", function () {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
active: this.checked // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
url: "{% url 'rapids:exam_toggle_active' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
active: this.checked // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Exam state changed.')
|
||||
toastr.info('Exam state changed.')
|
||||
}
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
@@ -85,20 +95,20 @@
|
||||
})
|
||||
$("#exam-publish-results-switch").on("change", function () {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_toggle_results_published' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
publish_results: this.checked // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
url: "{% url 'rapids:exam_toggle_results_published' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
publish_results: this.checked // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Publish results state changed.')
|
||||
toastr.info('Publish results state changed.')
|
||||
}
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
@@ -109,14 +119,14 @@
|
||||
})
|
||||
$("#button-open-access").click(function () {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: true,
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: true,
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
@@ -128,8 +138,8 @@
|
||||
toastr.info(data.status);
|
||||
}
|
||||
})
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
@@ -137,14 +147,14 @@
|
||||
})
|
||||
$("#button-closed-access").click(function () {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: false,
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_open_access: false,
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
@@ -156,8 +166,8 @@
|
||||
toastr.info(data.status);
|
||||
}
|
||||
})
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
.fail((e) => {
|
||||
toastr.warning(`Error, ${e}`);
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
@@ -168,30 +178,30 @@
|
||||
sortable('.sortable');
|
||||
|
||||
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
|
||||
new_order = [];
|
||||
$("#full-question-list li").each((n, el) => {
|
||||
new_order.push(el.dataset.question_pk)
|
||||
})
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_exam_order: JSON.stringify(new_order),
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
new_order = [];
|
||||
$("#full-question-list li").each((n, el) => {
|
||||
new_order.push(el.dataset.question_pk)
|
||||
})
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
set_exam_order: JSON.stringify(new_order),
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Exam order changed.')
|
||||
}
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
if (data.status == "success") {
|
||||
toastr.info('Exam order changed.')
|
||||
}
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user