From 71dab31103da2139fd47a8d69a93ea3b9acf4ec9 Mon Sep 17 00:00:00 2001 From: manandeep singh Date: Mon, 7 Oct 2024 12:18:01 +0530 Subject: [PATCH 1/2] fix advance timer issues with qsm timer --- js/qsm-quiz.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 7ec40132..5f08c5b7 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -162,6 +162,7 @@ var qsmTimerInterval = []; * @param int quizID The ID of the quiz. */ timer: function (quizID) { + jQuery(document).trigger('qmn_timer_consumed_seconds', [quizID, qmn_quiz_data, qsm_timer_consumed_obj]); qmn_quiz_data[quizID].timerRemaning -= 1; qmn_quiz_data[quizID].timerConsumed += 1; if (0 > qmn_quiz_data[quizID].timerRemaning) { @@ -176,6 +177,9 @@ var qsmTimerInterval = []; } } var display = QSM.secondsToTimer(secondsRemaining); + if(qsm_timer_consumed_obj.qmn_count_upward_status == true){ + display = QSM.secondsToTimer(secondsConsumed); + } var systemTime = new Date().getTime() / 1000; systemTime = Math.round(systemTime); if ('1' === qmn_quiz_data[quizID].not_allow_after_expired_time && systemTime > qmn_quiz_data[quizID].scheduled_time_end) { @@ -2079,4 +2083,7 @@ jQuery(document).keydown(function(event) { } jQuery(document).trigger('qsm_keyboard_quiz_action_end', event); } -}); \ No newline at end of file +}); +const qsm_timer_consumed_obj = { + qmn_count_upward_status : false +} \ No newline at end of file From 7f115a99c2c0f11c1e9d10de34aa23715c4d4321 Mon Sep 17 00:00:00 2001 From: manandeep singh Date: Mon, 7 Oct 2024 12:30:48 +0530 Subject: [PATCH 2/2] Fix timer issues --- js/qsm-quiz.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 5f08c5b7..903727e1 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -177,7 +177,7 @@ var qsmTimerInterval = []; } } var display = QSM.secondsToTimer(secondsRemaining); - if(qsm_timer_consumed_obj.qmn_count_upward_status == true){ + if(qsm_timer_consumed_obj.qmn_count_upward_status){ display = QSM.secondsToTimer(secondsConsumed); } var systemTime = new Date().getTime() / 1000;