Skip to content

Commit

Permalink
Merge branch 'MDL-74378_403' of https://github.com/PhilippImhof/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_403_STABLE
  • Loading branch information
HuongNV13 committed Nov 30, 2023
2 parents 83e442c + e82f1d4 commit c5e3ce2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mod/quiz/module.js
Expand Up @@ -178,6 +178,13 @@ M.mod_quiz.timer = {
updateEndTime: function(timeleft) {
var newtimeleft = new Date().getTime() + timeleft * 1000;

// Timer might not have been initialized yet. We initialize it with
// preview = 0, because it's better to take a preview for a real quiz
// than to take a real quiz for a preview.
if (M.mod_quiz.timer.Y === null) {
M.mod_quiz.timer.init(window.Y, timeleft, 0);
}

// Only update if change is greater than the threshold, so the
// time doesn't bounce around unnecessarily.
if (Math.abs(newtimeleft - M.mod_quiz.timer.endtime) > M.mod_quiz.timer.threshold) {
Expand Down

0 comments on commit c5e3ce2

Please sign in to comment.