From 3e459b0392257bd299d282bf228ad8bee6ece32b Mon Sep 17 00:00:00 2001 From: manandeep singh Date: Mon, 7 Oct 2024 10:51:29 +0530 Subject: [PATCH 1/2] fix advance timer issues with QSM --- js/qsm-quiz.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 89c3611eb..da6c88a98 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -171,11 +171,15 @@ var qsmTimerInterval = []; var secondsConsumed = qmn_quiz_data[quizID].timerConsumed; if (localStorage.getItem('mlw_time_quiz' + quizID) != null ) { secondsRemaining = (parseFloat(qmn_quiz_data[quizID].timer_limit) * 60) - secondsConsumed + 1; - if(secondsRemaining < 0) { + if(secondsRemaining <= 0) { secondsRemaining = 0; + secondsConsumed = 0; } } var display = QSM.secondsToTimer(secondsRemaining); + if(qmn_quiz_data[quizID].advanced_timer.qsm_timer_count_upwards == 1){ + 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) { From 9d0635095228d9c1ff114140cddce9ca5647d02e Mon Sep 17 00:00:00 2001 From: manandeep singh Date: Mon, 7 Oct 2024 11:53:58 +0530 Subject: [PATCH 2/2] fix advance timer issues with QSM --- js/qsm-quiz.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index da6c88a98..af8382bde 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -169,15 +169,15 @@ var qsmTimerInterval = []; } var secondsRemaining = qmn_quiz_data[quizID].timerRemaning; var secondsConsumed = qmn_quiz_data[quizID].timerConsumed; + jQuery(document).trigger('qmn_timer_consumed_seconds', [quizID, qmn_quiz_data, qsm_timer_consumed_obj]); if (localStorage.getItem('mlw_time_quiz' + quizID) != null ) { secondsRemaining = (parseFloat(qmn_quiz_data[quizID].timer_limit) * 60) - secondsConsumed + 1; - if(secondsRemaining <= 0) { + if(secondsRemaining < 0) { secondsRemaining = 0; - secondsConsumed = 0; } } var display = QSM.secondsToTimer(secondsRemaining); - if(qmn_quiz_data[quizID].advanced_timer.qsm_timer_count_upwards == 1){ + if(qsm_timer_consumed_obj.qmn_count_upward_status == true){ display = QSM.secondsToTimer(secondsConsumed); } var systemTime = new Date().getTime() / 1000; @@ -2083,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