From 27522aef1b7d39ed09b31a6edc197f61799d359c Mon Sep 17 00:00:00 2001 From: crib Date: Wed, 17 Dec 2025 21:27:08 +0100 Subject: [PATCH] Fixed a issue where stop did not reset the timer --- main.ts | 10 ++++++++++ view.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/main.ts b/main.ts index 47e1ea8..0488b0a 100644 --- a/main.ts +++ b/main.ts @@ -132,6 +132,16 @@ export default class TaskWeaverPlugin extends Plugin { await this.saveSettings(); } + async stopTaskTimer(taskId: string): Promise { + const task = this.settings.tasks.find(t => t.id === taskId); + if (!task) return; + + task.startTime = null; + task.totalElapsed = 0; + + await this.saveSettings(); + } + async toggleTaskComplete(taskId: string): Promise { const task = this.settings.tasks.find(t => t.id === taskId); if (!task) return; diff --git a/view.ts b/view.ts index eb0ba94..6c2fa08 100644 --- a/view.ts +++ b/view.ts @@ -127,7 +127,7 @@ export class TaskWeaverView extends ItemView { cls: "taskweaver-timer-control-btn stop" }); stopBtn.onclick = async () => { - await this.plugin.toggleTaskTimer(task.id); + await this.plugin.stopTaskTimer(task.id); }; const completeBtn = timerControls.createEl("button", {