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:
2025-11-25 10:11:05 +01:00
parent b3aa1f2992
commit 50ef40d2e0
4 changed files with 16 additions and 13 deletions

10
main.js
View File

@@ -1287,7 +1287,7 @@ var ImmersePlugin = class extends import_obsidian4.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;
@@ -1325,7 +1325,7 @@ var ImmersePlugin = class extends import_obsidian4.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;
@@ -1446,7 +1446,7 @@ var ImmersePlugin = class extends import_obsidian4.Plugin {
this.updateStatusBar();
this.refreshView();
}
stopTimer() {
stopTimer(preserveActualTime = false) {
if (this.timerInterval) {
window.clearInterval(this.timerInterval);
this.timerInterval = null;
@@ -1455,7 +1455,9 @@ var ImmersePlugin = class extends import_obsidian4.Plugin {
const task = this.data.tasks.find((t) => t.id === this.activeTaskId);
if (task) {
task.isActive = false;
task.actualMinutes = 0;
if (!preserveActualTime) {
task.actualMinutes = 0;
}
}
}
this.isTimerRunning = false;

View File

@@ -1,7 +1,7 @@
{
"id": "immerse",
"name": "Immerse",
"version": "1.1.0",
"version": "1.1.1",
"minAppVersion": "0.15.0",
"description": "A Blitzit-inspired task management and focus timer plugin. Plan your day, track time with Pomodoro technique, and crush your tasks with satisfying checkoffs.",
"author": "Crib",

View File

@@ -1,6 +1,6 @@
{
"name": "immerse",
"version": "1.1.0",
"version": "1.1.1",
"description": "A Blitzit-inspired task management and focus timer plugin for Obsidian",
"main": "main.js",
"scripts": {

View File

@@ -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;
}
}
}