This commit is contained in:
Ross
2021-08-19 13:02:25 +01:00
parent 8198effa10
commit 15ca934285
+11 -11
View File
@@ -11,8 +11,8 @@
<h3>Candidate: {{ cid }}</h3> <h3>Candidate: {{ cid }}</h3>
Answers: Answers:
<ul>{% for ans, score, correct_answer in answers_and_marks %} <ul>{% for ans, score, correct_answer in answers_and_marks %}
<li class="user-answer-li">Question {{forloop.counter}} - Correct answer: <span class="correct-answer">{{ <li class="user-answer-li">Question {{forloop.counter}} - Correct answer: <span
correct_answer }}</span></li> class="correct-answer">{{ correct_answer }}</span></li>
<span class="user-answer-score user-answer-score-{{score}} rapid-ans"> <span class="user-answer-score user-answer-score-{{score}} rapid-ans">
<pre>{{ans}}</pre> ({{score}}) <pre>{{ans}}</pre> ({{score}})
</span> </span>
@@ -32,20 +32,20 @@
console.log("click", e) console.log("click", e)
question_number = e.currentTarget.dataset.qn; question_number = e.currentTarget.dataset.qn;
$.ajax({ $.ajax({
url: `{% url 'rapids:question_review' pk=exam.pk %}`, url: `{% url 'rapids:question_review' pk=exam.pk %}`,
data: { data: {
csrfmiddlewaretoken: "{{ csrf_token }}", csrfmiddlewaretoken: "{{ csrf_token }}",
question_number: question_number question_number: question_number
}, },
type: "POST", type: "POST",
dataType: "json", dataType: "json",
}) })
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
.done(function (data) { .done(function (data) {
console.log(data); console.log(data);
if (data.status == "success") { if (data.status == "success") {
toastr.info('Exam state changed.') toastr.info('Exam state changed.')
} }
// 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 // For eg. A message box showing that the status has been changed