General Bugfixes

This commit is contained in:
2025-11-23 15:33:51 +01:00
parent 2800a7507e
commit c8f5c69102
3 changed files with 20 additions and 2 deletions

View File

@@ -279,6 +279,9 @@ export default class FocusTaskPlugin extends Plugin {
const elapsedMs = now - this.timerStartTimestamp;
const elapsedSeconds = Math.floor(elapsedMs / 1000);
// If less than 1 second elapsed, no need to sync
if (elapsedSeconds < 1) return;
if (this.isBreakMode) {
// Break mode: countdown timer
this.currentTimerSeconds = Math.max(0, this.pausedTimeRemaining - elapsedSeconds);
@@ -312,6 +315,10 @@ export default class FocusTaskPlugin extends Plugin {
}
}
// Reset timestamp to now to prevent double-counting on next sync
this.timerStartTimestamp = now;
this.pausedTimeRemaining = this.currentTimerSeconds;
// Update displays
this.updateStatusBar();
this.updateTimerDisplay();
@@ -538,6 +545,9 @@ export default class FocusTaskPlugin extends Plugin {
const task = this.data.tasks.find(t => t.id === this.activeTaskId);
if (task) {
task.isActive = false;
// Reset actual time when manually stopping (not after a break)
// This allows starting fresh next time
task.actualMinutes = 0;
}
}