From f7d6defc6cf8b29dec6321a192cad8eb73dbd4e7 Mon Sep 17 00:00:00 2001 From: stilbruch Date: Mon, 16 May 2022 18:26:27 -0500 Subject: Timers automatically check row when done --- app/static/js/record.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/static/js/record.js b/app/static/js/record.js index 2e99766..c8a7810 100644 --- a/app/static/js/record.js +++ b/app/static/js/record.js @@ -78,11 +78,17 @@ class Timer { // Finish timer finish() { + if (this.finished) { + return; + } console.log("Finished..."); this.finished = true; this.pause(); this.setIcon('fa-refresh'); + this.elem.disabled = true; + this.elem.classList.add('is-success') + setCheck(this.row); } reset() { @@ -191,11 +197,7 @@ function setCheck(row) { // TODO: better way to check if (row.dataset.isTimer) { const timerButton = row.children[1].children[0].children[0]; - if (timerButton.timer) { - timerButton.timer.finish(); - } - timerButton.disabled = true; - timerButton.classList.add('is-success'); + Timer.fromElem(timerButton).finish(); } else { // Disable input editing row.children[1].firstChild.disabled = true; -- cgit v1.2.3