feat: quiz marks and passing percentage
This commit is contained in:
@@ -6,6 +6,15 @@
|
||||
{{ _("This quiz consists of {0} questions.").format(quiz.questions | length) }}
|
||||
</li>
|
||||
|
||||
{% if quiz.passing_percentage %}
|
||||
<li>
|
||||
{{ _("You will have to get {0}% correct answers in order to pass the quiz.").format(quiz.passing_percentage) }}
|
||||
</li>
|
||||
<li>
|
||||
{{ _("Without passing the quiz you won't be able to complete the lesson.") }}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if quiz.max_attempts %}
|
||||
{% set suffix = "times" if quiz.max_attempts > 1 else "time" %}
|
||||
<li>
|
||||
@@ -18,8 +27,7 @@
|
||||
{{ _("The quiz has a time limit. For each question you will be given {0} seconds.").format(quiz.time) }}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
||||
<div id="start-banner" class="common-card-style column-card align-items-center">
|
||||
|
||||
@@ -50,6 +58,9 @@
|
||||
<div class="question hide" data-name="{{ question.name }}" data-type="{{ question.type }}"
|
||||
data-multi="{{ question.multiple }}" data-qt-index="{{ loop.index }}">
|
||||
<div>
|
||||
<div class="pull-right font-weight-bold">
|
||||
{{ question.marks }} {{ _("Marks") }}
|
||||
</div>
|
||||
<div class="question-number">
|
||||
{{ _("Question ") }}{{ loop.index }}: {{ instruction }}
|
||||
</div>
|
||||
|
||||
@@ -120,7 +120,6 @@ const enable_check = (e) => {
|
||||
const quiz_summary = (e = undefined) => {
|
||||
e && e.preventDefault();
|
||||
let quiz_name = $("#quiz-title").data("name");
|
||||
let total_questions = $(".question").length;
|
||||
let self = this;
|
||||
|
||||
frappe.call({
|
||||
@@ -136,13 +135,16 @@ const quiz_summary = (e = undefined) => {
|
||||
$("#quiz-form").prepend(
|
||||
`<div class="summary bold-heading text-center">
|
||||
${__("Your score is")} ${data.message.score}
|
||||
${__("out of")} ${total_questions}
|
||||
${__("out of")} ${data.message.score_out_of}
|
||||
</div>`
|
||||
);
|
||||
$("#try-again").attr("data-submission", data.message.submission);
|
||||
$("#try-again").removeClass("hide");
|
||||
self.quiz_submitted = true;
|
||||
if (this.hasOwnProperty("marked_as_complete")) {
|
||||
if (
|
||||
this.hasOwnProperty("marked_as_complete") &&
|
||||
data.message.pass
|
||||
) {
|
||||
mark_progress();
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user