Enhance shorts exam functionality by adding history tracking and updating feedback display in exam scores template
This commit is contained in:
+2
-2
@@ -2296,7 +2296,7 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
ans = user_answer.get_answer()
|
ans = user_answer.get_answer()
|
||||||
answer_score = user_answer.get_answer_score()
|
answer_score = user_answer.get_answer_score()
|
||||||
|
|
||||||
if self.app_name == "longs":
|
if self.app_name in ("longs", "shorts"):
|
||||||
feedback = user_answer.candidate_feedback
|
feedback = user_answer.candidate_feedback
|
||||||
|
|
||||||
match self.app_name:
|
match self.app_name:
|
||||||
@@ -2336,7 +2336,7 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
answers.append(ans)
|
answers.append(ans)
|
||||||
answers_marks.append(answer_score)
|
answers_marks.append(answer_score)
|
||||||
|
|
||||||
if self.app_name == "longs":
|
if self.app_name in ("longs", "shorts"):
|
||||||
answers_and_marks.append(
|
answers_and_marks.append(
|
||||||
(ans, answer_score, correct_answer, feedback)
|
(ans, answer_score, correct_answer, feedback)
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -234,7 +234,7 @@ class Question(QuestionBase):
|
|||||||
based: bool = True,
|
based: bool = True,
|
||||||
feedback: bool = False,
|
feedback: bool = False,
|
||||||
answers: bool = True,
|
answers: bool = True,
|
||||||
history: bool = False,
|
history: bool = True,
|
||||||
annotations: bool = False,
|
annotations: bool = False,
|
||||||
) -> QuestionData:
|
) -> QuestionData:
|
||||||
"""Returns a json representation of the question"""
|
"""Returns a json representation of the question"""
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
Question <span class="question-number">1</span>
|
Question <span class="question-number">1</span>
|
||||||
<div id="single-dicom-viewer" class="dicom-viewer" data-images="" data-annotations=''>
|
<div id="single-dicom-viewer" class="dicom-viewer" data-images="" data-annotations=''>
|
||||||
</div>
|
</div>
|
||||||
<div class="feedback"></div>
|
<div class="history"></div>
|
||||||
<div>
|
<div>
|
||||||
<details>
|
<details>
|
||||||
<summary>Sample Answers:</summary>
|
<summary>Sample Answers:</summary>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="shorts">
|
<div class="shorts">
|
||||||
{% include 'user_score_header.html' %}
|
{% include 'user_score_header.html' %}
|
||||||
<ul class="score-answer-list">
|
<ul class="score-answer-list">
|
||||||
{% for ans, score, correct_answer in answers_and_marks %}
|
{% for ans, score, correct_answer, feedback in answers_and_marks %}
|
||||||
<li class="user-answer-li" data-question-number="{{forloop.counter}}">Question {{forloop.counter}} - Correct answer: {% if exam.publish_results %}<span class="correct-answer">{{correct_answer}}</span>{% endif %}
|
<li class="user-answer-li" data-question-number="{{forloop.counter}}">Question {{forloop.counter}} - Correct answer: {% if exam.publish_results %}<span class="correct-answer">{{correct_answer}}</span>{% endif %}
|
||||||
<span class="view-question-link" data-qn={{forloop.counter0}}>View</span>
|
<span class="view-question-link" data-qn={{forloop.counter0}}>View</span>
|
||||||
<br/>
|
<br/>
|
||||||
@@ -28,8 +28,11 @@
|
|||||||
<span class="submitted-user-answer">
|
<span class="submitted-user-answer">
|
||||||
<pre>{{ans}}</pre>
|
<pre>{{ans}}</pre>
|
||||||
</span>
|
</span>
|
||||||
{% if exam.publish_results or view_all_results%}
|
{% if exam.publish_results or view_all_results %}
|
||||||
<span class="answer-score">Score: {{score}}</span>
|
<span class="answer-score">Score: {{score}}</span>
|
||||||
|
{% if feedback %}
|
||||||
|
<span class="answer-feedback badge badge-secondary" style="margin-left:10px;">Feedback: {{ feedback }}</span>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
@@ -73,7 +76,15 @@
|
|||||||
"detail": { "images": images, "annotations": data.annotations }
|
"detail": { "images": images, "annotations": data.annotations }
|
||||||
});
|
});
|
||||||
|
|
||||||
window.dispatchEvent(event);
|
if (!images || images.length === 0) {
|
||||||
|
$("#single-dicom-viewer").html("<p>No images for this question</p>");
|
||||||
|
} else{
|
||||||
|
window.dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.history) {
|
||||||
|
$(".question-display-block .history").empty().append(`History:<pre>${data.history}</pre>`);
|
||||||
|
}
|
||||||
console.log(data)
|
console.log(data)
|
||||||
if (data.answers && data.answers.length > 0) {
|
if (data.answers && data.answers.length > 0) {
|
||||||
// Format: [[answer, score], ...]
|
// Format: [[answer, score], ...]
|
||||||
@@ -86,7 +97,6 @@
|
|||||||
}
|
}
|
||||||
n = parseInt(question_number) + 1
|
n = parseInt(question_number) + 1
|
||||||
$(".question-display-block .question-number").empty().append(n);
|
$(".question-display-block .question-number").empty().append(n);
|
||||||
$(".question-display-block .feedback").empty().append(`Feedback: ${data.feedback}<br />`);
|
|
||||||
// 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
|
||||||
$(".inner-display-block").show();
|
$(".inner-display-block").show();
|
||||||
|
|||||||
Reference in New Issue
Block a user