Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix advance timer issues with qsm timer #2667

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -176,6 +177,9 @@ var qsmTimerInterval = [];
}
}
var display = QSM.secondsToTimer(secondsRemaining);
if(qsm_timer_consumed_obj.qmn_count_upward_status){
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) {
Expand Down Expand Up @@ -2079,4 +2083,7 @@ jQuery(document).keydown(function(event) {
}
jQuery(document).trigger('qsm_keyboard_quiz_action_end', event);
}
});
});
const qsm_timer_consumed_obj = {
qmn_count_upward_status : false
}