This commit is contained in:
Ross
2021-09-25 19:20:47 +01:00
parent c93e5d4a10
commit 0cb4294427
6 changed files with 280 additions and 92 deletions
+36 -36
View File
@@ -1,40 +1,40 @@
{% extends 'rapids/base.html' %}
{% block content %}
<div class="question-display-block">
Question <span class="question-number">1</span>
<div id="single-dicom-viewer" class="dicom-viewer" data-images="" data-annotations=''>
<div class="question-display-block">
Question <span class="question-number">1</span>
<div id="single-dicom-viewer" class="dicom-viewer" data-images="" data-annotations=''>
</div>
<div class="answers">Answers: </div>
</div>
<div class="answers">Answers: </div>
</div>
<div class="rapids">
<h2>Exam: {{ exam.name }}</h2>
<h3>Candidate: {{ cid }}</h3>
Answers:
<ul class="score-answer-list">{% for ans, score, correct_answer in answers_and_marks %}
<li class="user-answer-li">Question {{forloop.counter}} - Correct answer: <span
<div class="rapids">
<h2>Exam: {{ exam.name }}</h2>
<h3>Candidate: {{ cid }}</h3>
Answers:
<ul class="score-answer-list">{% for ans, score, correct_answer in answers_and_marks %}
<li class="user-answer-li">Question {{forloop.counter}} - Correct answer: <span
class="correct-answer">{{ correct_answer }}</span></li>
<span class="user-answer-score user-answer-score-{{score}} rapid-ans">
<pre>{{ans}}</pre> ({{score}})
</span>
<span class="view-question-link" data-qn={{forloop.counter0}}>View</span>
<span class="user-answer-score user-answer-score-{{score}} rapid-ans">
<pre>{{ans}}</pre> ({{score}})
</span>
<span class="view-question-link" data-qn={{forloop.counter0}}>View</span>
{% endfor %}
</ul>
<br /> Total mark: {{ total_score }} / {{max_score}}
<br /> Normalised score: {{ normalised_score }}
<div>
<a href="{% url 'cid_scores' cid %}">Other exams</a>
</ul>
<br /> Total mark: {{ total_score }} / {{max_score}}
<br /> Normalised score: {{ normalised_score }}
<div>
<a href="{% url 'cid_scores' cid %}">Other exams</a>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function () {
$(".view-question-link").on("click", function (e) {
console.log("click", e)
question_number = e.currentTarget.dataset.qn;
$("#single-dicom-viewer").empty();
$.ajax({
<script>
$(document).ready(function () {
$(".view-question-link").on("click", function (e) {
console.log("click", e)
question_number = e.currentTarget.dataset.qn;
$("#single-dicom-viewer").empty();
$.ajax({
url: `{% url 'rapids:question_review' pk=exam.pk %}`,
data: {
csrfmiddlewaretoken: "{{ csrf_token }}",
@@ -44,7 +44,7 @@
dataType: "json",
})
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
.done(function (data) {
.done(function (data) {
console.log(data);
let event = new CustomEvent('loadDicomViewerUrls', {
@@ -55,16 +55,16 @@
$(".question-display-block .answers").empty().append(data.answers.toString());
n = parseInt(question_number) + 1
$(".question-display-block .question-number").empty().append(n);
// show some message according to the response.
// show some message according to the response.
// For eg. A message box showing that the status has been changed
})
.always(function () {
.always(function () {
console.log('[Done]');
})
})
})
$(".view-question-link").first().click();
$(".view-question-link").first().click();
});
</script>
{% endblock %}
});
</script>
{% endblock %}
+10 -2
View File
@@ -17,7 +17,11 @@ urlpatterns = [
path(
"question/<int:pk>/", views.question_detail, name="question_detail"
), # path("question/<int:pk>/json", views.question_json, name="question_json"),
path("question/<int:pk>/save_annotation", views.question_save_annotation, name="question_save_annotation"),
path(
"question/<int:pk>/save_annotation",
views.question_save_annotation,
name="question_save_annotation",
),
path("question/<int:pk>/split", views.rapid_split, name="rapid_split"),
path("question/<int:pk>/clone", views.RapidClone.as_view(), name="rapid_clone"),
# path("verified/", views.verified, name="verified"),
@@ -54,7 +58,11 @@ urlpatterns = [
views.RapidExamViews.exam_json_edit,
name="exam_json_edit",
),
path("exam/<int:pk>/scores", cache_page(60 * 1)(views.exam_scores_cid), name="exam_scores_cid"),
path(
"exam/<int:pk>/scores",
cache_page(60 * 1)(views.exam_scores_cid),
name="exam_scores_cid",
),
path(
"exam/<int:pk>/scores/<int:cid>/",
views.exam_scores_cid_user,