diff --git a/static_src/timer.js b/static_src/timer.js index 6d73c6d0935a6996b93059c0563488dc9acc564e..ce4212e0aaa3e926f7b3b5d0c5fc1190e7f0c1a2 100644 --- a/static_src/timer.js +++ b/static_src/timer.js @@ -151,13 +151,15 @@ $(window).ready( } if ("is_running" in data) { + const remainingTime = window.timer.getTimeValues() + if (data["is_running"]) { // Don't do anything if we have reached an inconsistent state, // where the timer is at 0 but server still reports it playing. // This will be resolved within a few milliseconds. - const remainingTime = window.timer.getTimeValues() - if (remainingTime.seconds === 0 && remainingTime.minutes === 0) { + if (remainingTime.minutes === 0 && remainingTime.seconds === 0) { + return } window.timer.start() @@ -166,6 +168,15 @@ $(window).ready( $("#pause_play > .btn__body").html("⏸︎") window.timerIsRunning = true } else { + if ( + window.timerIsRunning + && "sync_time" in data + && data["sync_time"]["minutes"] === 0 + && data["sync_time"]["seconds"] === 0 + ) { + return + } + window.timer.pause() $("#is_counting").prop("checked", false)