some refactoring and atlas improvements

This commit is contained in:
Ross
2023-07-24 11:56:12 +01:00
parent e6469e70f0
commit dd300afd63
26 changed files with 521 additions and 170 deletions
@@ -0,0 +1,43 @@
# Generated by Django 4.1.4 on 2023-07-24 09:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rapids', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='exam',
name='candidates_only',
field=models.BooleanField(default=True, help_text='If the exam/collection is only available to candidates who have been added'),
),
migrations.AlterField(
model_name='exam',
name='active',
field=models.BooleanField(default=False, help_text='If an exam/collection should be available to take'),
),
migrations.AlterField(
model_name='exam',
name='archive',
field=models.BooleanField(default=False, help_text='Archived exams/collections will remain on the test system but will not be displayed by default'),
),
migrations.AlterField(
model_name='exam',
name='name',
field=models.CharField(help_text='Name of the exam/collection', max_length=200),
),
migrations.AlterField(
model_name='exam',
name='open_access',
field=models.BooleanField(default=False, help_text='If the exam/collection is freely accessible (to view and edit on the test system)'),
),
migrations.AlterField(
model_name='exam',
name='publish_results',
field=models.BooleanField(default=False, help_text='If an exam/collections results should be available'),
),
]
@@ -1,5 +1,5 @@
<div class="rapid {% if question.scrapped %}rapid-scrapped{% endif %}">
<button id="edit-button">Inline Edit</button>
{% comment %} <button id="edit-button">Inline Edit</button> {% endcomment %}
<div class="date">
{{ question.created_date|date:"d/m/Y" }}
</div>
@@ -9,7 +9,7 @@
<p class="pre-whitespace"><b>Rapid:</b> {{ question }}</p>
<p class="pre-whitespace"><b>Normal:</b> {{ question.normal }} <button id="toggle-normal-button"
class="toggle-button">toggle</button></p>
class="toggle-button">toggle</button></p>
<p class="pre-whitespace"><b>Region:</b> {{ question.get_regions }}</p>
<p class="pre-whitespace"><b>Examination:</b> {{ question.get_examinations }}</p>
<p class="pre-whitespace"><b>Laterality:</b> {{ question.laterality }}
@@ -24,7 +24,7 @@
<span class="image-block">
Image {{ forloop.counter }}{% if image.description %} ({{image.description}}){% endif %}{% if image.feedback_image %} [feedback image]{% endif %}:
<div class="dicom-image rapid-img {% if image.feedback_image %}feedback-img{% endif %}"
data-url="https://www.penracourses.org.uk{{ image.image.url}}"></div>
data-url="https://www.penracourses.org.uk{{ image.image.url}}"></div>
</span>
{% endfor %}
</div>
@@ -33,11 +33,11 @@
<a href="{% url 'rapids:exam_overview' pk=exam.pk %}">{{ exam.name }}</a>,
{% endfor %}
<button id="add-to-exam" data-exam_json_edit_url="{% url 'generic:generic_exam_json_edit' %}"
{% comment %} <button id="add-to-exam" data-exam_json_edit_url="{% url 'generic:generic_exam_json_edit' %}"
data-exam_list_url="{% url 'api-1:rapid_user_exams' %}" data-type="rapids" data-csrf="{{ csrf_token}}"
data-qid="{{question.pk}}">Add to exam</button>
<button id="cancel-add-to-exam" style="display:none">Cancel</button>
<span id="exam-options"></span>
<span id="exam-options"></span> {% endcomment %}
</div>
<p class="pre-whitespace"><b>Open Access:</b> {{ question.open_access }}</p>
<p class="pre-whitespace"><b>Feedback:</b> {{ question.feedback }}</p>
@@ -59,7 +59,7 @@
<tr>
<td>
<span {% if answer.proposed %}class="proposed-answer" data-aid="{{answer.pk}}" data-question-type="rapid"
{% endif %}>
{% endif %}>
{{ answer }}
</span>
<td>
@@ -94,7 +94,7 @@
Image viewer
</summary>
<div id="single-dicom-viewer" class="dicom-viewer" data-images="{{ question.get_image_url_array }}"
data-annotations='{{question.get_image_annotations}}'>
data-annotations='{{question.get_image_annotations}}'>
</div>
<button id="save-annotations" class="save-rapid-annotations">Save Annotations</button>
</details>
@@ -110,7 +110,7 @@
{% endfor %}
</details>
<a href="{% url 'rapids:question_anonymise_dicom' pk=question.pk %}"
title="Anonymise dicom images">Anonymise dicoms</a><br />
title="Anonymise dicom images">Anonymise dicoms</a><br />
<script>
$(document).ready(function () {
$("#edit-button").click(() => {
@@ -156,21 +156,21 @@
})
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
.done(function (data) {
console.log(data);
console.log(data);
// show some message according to the response.
// For eg. A message box showing that the status has been changed
if (data.status == "success") {
toastr.info('Annotations saved')
} else {
toastr.warning('Error saving annotations')
}
})
if (data.status == "success") {
toastr.info('Annotations saved')
} else {
toastr.warning('Error saving annotations')
}
})
.always(function () {
console.log('[Done]');
})
console.log('[Done]');
})
})
$("#cancel-add-to-exam").click(function (evt) {
{% comment %} $("#cancel-add-to-exam").click(function (evt) {
$("#add-to-exam").toggle();
$("#cancel-add-to-exam").toggle();
$("#exam-options").empty();
@@ -296,7 +296,8 @@
alert('Error updating this model instance.');
});
});
});
});
{% endcomment %}
$(".suggested_answers li").each((n, el) => {
$(el).append($("<span class='correct'>[Add Correct]</span>").on("click", function () {
@@ -315,18 +316,18 @@
})
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
.done(function (data) {
console.log(data);
console.log(data);
if (data.success) {
toastr.info('Answer saved')
$(el).find(".correct").remove()
}
if (data.success) {
toastr.info('Answer saved')
$(el).find(".correct").remove()
}
// show some message according to the response.
// For eg. A message box showing that the status has been changed
})
})
.always(function () {
console.log('[Done]');
})
console.log('[Done]');
})
}))
});
@@ -350,19 +351,19 @@
})
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
.done(function (data) {
console.log(data);
console.log(data);
if (data.success) {
toastr.info('Answer saved')
$(el).find(".confirm").remove()
$(el).removeClass("proposed-answer")
}
if (data.success) {
toastr.info('Answer saved')
$(el).find(".confirm").remove()
$(el).removeClass("proposed-answer")
}
// show some message according to the response.
// For eg. A message box showing that the status has been changed
})
})
.always(function () {
console.log('[Done]');
})
console.log('[Done]');
})
}))
// Add button to confirm answer is incorrect
@@ -381,19 +382,19 @@
})
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
.done(function (data) {
console.log(data);
console.log(data);
if (data.success) {
toastr.info('Answer saved')
$(el).find(".confirm").remove()
$(el).removeClass("proposed-answer")
}
if (data.success) {
toastr.info('Answer saved')
$(el).find(".confirm").remove()
$(el).removeClass("proposed-answer")
}
// show some message according to the response.
// For eg. A message box showing that the status has been changed
})
})
.always(function () {
console.log('[Done]');
})
console.log('[Done]');
})
}))
});
});