Release v1.1.1: Critical timer bug fix
Fixed critical bug where actual time spent on tasks was being reset to 0 when resuming work after a break in Pomodoro mode. ## Bug Fix - Fixed timer actual time resetting to 0 when skipping break or resuming work - Added preserveActualTime parameter to stopTimer() function - Actual time now correctly accumulates across multiple Pomodoro sessions
This commit is contained in:
15
src/main.ts
15
src/main.ts
@@ -544,8 +544,8 @@ export default class ImmersePlugin extends Plugin {
|
||||
const task = this.data.tasks.find(t => t.id === taskId);
|
||||
if (!task) return;
|
||||
|
||||
// Stop any existing timer
|
||||
this.stopTimer();
|
||||
// Stop any existing timer, preserving actual time
|
||||
this.stopTimer(true);
|
||||
|
||||
// Set active task
|
||||
this.activeTaskId = taskId;
|
||||
@@ -606,7 +606,7 @@ export default class ImmersePlugin extends Plugin {
|
||||
const task = this.data.tasks.find(t => t.id === taskId);
|
||||
if (!task) return;
|
||||
|
||||
this.stopTimer();
|
||||
this.stopTimer(true);
|
||||
this.activeTaskId = taskId;
|
||||
task.isActive = true;
|
||||
this.isBreakMode = false;
|
||||
@@ -796,7 +796,7 @@ export default class ImmersePlugin extends Plugin {
|
||||
this.refreshView();
|
||||
}
|
||||
|
||||
stopTimer() {
|
||||
stopTimer(preserveActualTime: boolean = false) {
|
||||
if (this.timerInterval) {
|
||||
window.clearInterval(this.timerInterval);
|
||||
this.timerInterval = null;
|
||||
@@ -806,9 +806,10 @@ export default class ImmersePlugin 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;
|
||||
// Only reset actual time when manually stopping (not when resuming after break)
|
||||
if (!preserveActualTime) {
|
||||
task.actualMinutes = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user