fix: Quiz timer (#25983)
* fix: quiz timer * fix: pass time bound parameter * fix: sider
This commit is contained in:
parent
10ec2eed6f
commit
6b8c123fd9
@ -219,7 +219,6 @@ def get_quiz(quiz_name, course):
|
||||
try:
|
||||
quiz = frappe.get_doc("Quiz", quiz_name)
|
||||
questions = quiz.get_questions()
|
||||
duration = quiz.duration
|
||||
except:
|
||||
frappe.throw(_("Quiz {0} does not exist").format(quiz_name), frappe.DoesNotExistError)
|
||||
return None
|
||||
@ -236,7 +235,8 @@ def get_quiz(quiz_name, course):
|
||||
return {
|
||||
'questions': questions,
|
||||
'activity': None,
|
||||
'duration':duration
|
||||
'is_time_bound': quiz.is_time_bound,
|
||||
'duration':quiz.duration
|
||||
}
|
||||
|
||||
student = get_current_student()
|
||||
@ -245,6 +245,7 @@ def get_quiz(quiz_name, course):
|
||||
return {
|
||||
'questions': questions,
|
||||
'activity': {'is_complete': status, 'score': score, 'result': result, 'time_taken': time_taken},
|
||||
'is_time_bound': quiz.is_time_bound,
|
||||
'duration': quiz.duration
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,8 @@ class Quiz {
|
||||
}
|
||||
|
||||
make(data) {
|
||||
if (data.duration) {
|
||||
const timer_display = document.createElement("div");
|
||||
timer_display.classList.add("lms-timer", "float-right", "font-weight-bold");
|
||||
document.getElementsByClassName("lms-title")[0].appendChild(timer_display);
|
||||
if (data.is_time_bound) {
|
||||
$(".lms-timer").removeClass("hide");
|
||||
if (!data.activity || (data.activity && !data.activity.is_complete)) {
|
||||
this.initialiseTimer(data.duration);
|
||||
this.is_time_bound = true;
|
||||
|
@ -64,6 +64,7 @@
|
||||
</div>
|
||||
<div class="lms-title">
|
||||
<h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{length}})</span></h2>
|
||||
<div class="lms-timer float-right fond-weight-bold hide"></div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user