Skip to content
Snippets Groups Projects
Commit 5e58abdb authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

let the timer count down on its own if within 5 seconds

parent d718632d
No related branches found
No related tags found
1 merge request!9Release
Pipeline #15170 passed
...@@ -151,13 +151,15 @@ $(window).ready( ...@@ -151,13 +151,15 @@ $(window).ready(
} }
if ("is_running" in data) { if ("is_running" in data) {
const remainingTime = window.timer.getTimeValues()
if (data["is_running"]) { if (data["is_running"]) {
// Don't do anything if we have reached an inconsistent state, // Don't do anything if we have reached an inconsistent state,
// where the timer is at 0 but server still reports it playing. // where the timer is at 0 but server still reports it playing.
// This will be resolved within a few milliseconds. // 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() window.timer.start()
...@@ -166,6 +168,15 @@ $(window).ready( ...@@ -166,6 +168,15 @@ $(window).ready(
$("#pause_play > .btn__body").html("⏸︎") $("#pause_play > .btn__body").html("⏸︎")
window.timerIsRunning = true window.timerIsRunning = true
} else { } else {
if (
window.timerIsRunning
&& "sync_time" in data
&& data["sync_time"]["minutes"] === 0
&& data["sync_time"]["seconds"] === 0
) {
return
}
window.timer.pause() window.timer.pause()
$("#is_counting").prop("checked", false) $("#is_counting").prop("checked", false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment