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:
10
main.js
10
main.js
@@ -1287,7 +1287,7 @@ var ImmersePlugin = class extends import_obsidian4.Plugin {
|
|||||||
const task = this.data.tasks.find((t) => t.id === taskId);
|
const task = this.data.tasks.find((t) => t.id === taskId);
|
||||||
if (!task)
|
if (!task)
|
||||||
return;
|
return;
|
||||||
this.stopTimer();
|
this.stopTimer(true);
|
||||||
this.activeTaskId = taskId;
|
this.activeTaskId = taskId;
|
||||||
task.isActive = true;
|
task.isActive = true;
|
||||||
this.isBreakMode = false;
|
this.isBreakMode = false;
|
||||||
@@ -1325,7 +1325,7 @@ var ImmersePlugin = class extends import_obsidian4.Plugin {
|
|||||||
const task = this.data.tasks.find((t) => t.id === taskId);
|
const task = this.data.tasks.find((t) => t.id === taskId);
|
||||||
if (!task)
|
if (!task)
|
||||||
return;
|
return;
|
||||||
this.stopTimer();
|
this.stopTimer(true);
|
||||||
this.activeTaskId = taskId;
|
this.activeTaskId = taskId;
|
||||||
task.isActive = true;
|
task.isActive = true;
|
||||||
this.isBreakMode = false;
|
this.isBreakMode = false;
|
||||||
@@ -1446,7 +1446,7 @@ var ImmersePlugin = class extends import_obsidian4.Plugin {
|
|||||||
this.updateStatusBar();
|
this.updateStatusBar();
|
||||||
this.refreshView();
|
this.refreshView();
|
||||||
}
|
}
|
||||||
stopTimer() {
|
stopTimer(preserveActualTime = false) {
|
||||||
if (this.timerInterval) {
|
if (this.timerInterval) {
|
||||||
window.clearInterval(this.timerInterval);
|
window.clearInterval(this.timerInterval);
|
||||||
this.timerInterval = null;
|
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);
|
const task = this.data.tasks.find((t) => t.id === this.activeTaskId);
|
||||||
if (task) {
|
if (task) {
|
||||||
task.isActive = false;
|
task.isActive = false;
|
||||||
task.actualMinutes = 0;
|
if (!preserveActualTime) {
|
||||||
|
task.actualMinutes = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.isTimerRunning = false;
|
this.isTimerRunning = false;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "immerse",
|
"id": "immerse",
|
||||||
"name": "Immerse",
|
"name": "Immerse",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"minAppVersion": "0.15.0",
|
"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.",
|
"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",
|
"author": "Crib",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "immerse",
|
"name": "immerse",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"description": "A Blitzit-inspired task management and focus timer plugin for Obsidian",
|
"description": "A Blitzit-inspired task management and focus timer plugin for Obsidian",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
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);
|
const task = this.data.tasks.find(t => t.id === taskId);
|
||||||
if (!task) return;
|
if (!task) return;
|
||||||
|
|
||||||
// Stop any existing timer
|
// Stop any existing timer, preserving actual time
|
||||||
this.stopTimer();
|
this.stopTimer(true);
|
||||||
|
|
||||||
// Set active task
|
// Set active task
|
||||||
this.activeTaskId = taskId;
|
this.activeTaskId = taskId;
|
||||||
@@ -606,7 +606,7 @@ export default class ImmersePlugin extends Plugin {
|
|||||||
const task = this.data.tasks.find(t => t.id === taskId);
|
const task = this.data.tasks.find(t => t.id === taskId);
|
||||||
if (!task) return;
|
if (!task) return;
|
||||||
|
|
||||||
this.stopTimer();
|
this.stopTimer(true);
|
||||||
this.activeTaskId = taskId;
|
this.activeTaskId = taskId;
|
||||||
task.isActive = true;
|
task.isActive = true;
|
||||||
this.isBreakMode = false;
|
this.isBreakMode = false;
|
||||||
@@ -796,7 +796,7 @@ export default class ImmersePlugin extends Plugin {
|
|||||||
this.refreshView();
|
this.refreshView();
|
||||||
}
|
}
|
||||||
|
|
||||||
stopTimer() {
|
stopTimer(preserveActualTime: boolean = false) {
|
||||||
if (this.timerInterval) {
|
if (this.timerInterval) {
|
||||||
window.clearInterval(this.timerInterval);
|
window.clearInterval(this.timerInterval);
|
||||||
this.timerInterval = null;
|
this.timerInterval = null;
|
||||||
@@ -806,9 +806,10 @@ export default class ImmersePlugin extends Plugin {
|
|||||||
const task = this.data.tasks.find(t => t.id === this.activeTaskId);
|
const task = this.data.tasks.find(t => t.id === this.activeTaskId);
|
||||||
if (task) {
|
if (task) {
|
||||||
task.isActive = false;
|
task.isActive = false;
|
||||||
// Reset actual time when manually stopping (not after a break)
|
// Only reset actual time when manually stopping (not when resuming after break)
|
||||||
// This allows starting fresh next time
|
if (!preserveActualTime) {
|
||||||
task.actualMinutes = 0;
|
task.actualMinutes = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user