General Bugfixes
This commit is contained in:
@@ -66,8 +66,11 @@ Focus Task brings the power of time-boxed task management directly into your Obs
|
|||||||
### Manual Installation
|
### Manual Installation
|
||||||
1. Download the latest release from the [releases page](https://git.cribdev.com/crib/focus-task/releases)
|
1. Download the latest release from the [releases page](https://git.cribdev.com/crib/focus-task/releases)
|
||||||
2. Extract the files to your vault's `.obsidian/plugins/focus-task/` folder
|
2. Extract the files to your vault's `.obsidian/plugins/focus-task/` folder
|
||||||
3. Reload Obsidian
|
3. **⚠️ IMPORTANT**: When updating, do NOT replace or delete the existing `data.json` file - this contains all your tasks, settings, and progress!
|
||||||
4. Enable the plugin in Settings → Community Plugins
|
4. Reload Obsidian
|
||||||
|
5. Enable the plugin in Settings → Community Plugins
|
||||||
|
|
||||||
|
> **Note**: Only copy the three plugin files (`main.js`, `manifest.json`, `styles.css`) when updating. Your `data.json` file stores all your tasks and settings and should never be replaced.
|
||||||
|
|
||||||
### Building from Source
|
### Building from Source
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
5
main.js
5
main.js
@@ -719,6 +719,8 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
|||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const elapsedMs = now - this.timerStartTimestamp;
|
const elapsedMs = now - this.timerStartTimestamp;
|
||||||
const elapsedSeconds = Math.floor(elapsedMs / 1e3);
|
const elapsedSeconds = Math.floor(elapsedMs / 1e3);
|
||||||
|
if (elapsedSeconds < 1)
|
||||||
|
return;
|
||||||
if (this.isBreakMode) {
|
if (this.isBreakMode) {
|
||||||
this.currentTimerSeconds = Math.max(0, this.pausedTimeRemaining - elapsedSeconds);
|
this.currentTimerSeconds = Math.max(0, this.pausedTimeRemaining - elapsedSeconds);
|
||||||
if (this.currentTimerSeconds <= 0) {
|
if (this.currentTimerSeconds <= 0) {
|
||||||
@@ -743,6 +745,8 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
|||||||
this.focusSecondsToday += elapsedSeconds;
|
this.focusSecondsToday += elapsedSeconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.timerStartTimestamp = now;
|
||||||
|
this.pausedTimeRemaining = this.currentTimerSeconds;
|
||||||
this.updateStatusBar();
|
this.updateStatusBar();
|
||||||
this.updateTimerDisplay();
|
this.updateTimerDisplay();
|
||||||
this.saveAllData();
|
this.saveAllData();
|
||||||
@@ -899,6 +903,7 @@ var FocusTaskPlugin = class extends import_obsidian3.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.isTimerRunning = false;
|
this.isTimerRunning = false;
|
||||||
|
|||||||
10
src/main.ts
10
src/main.ts
@@ -279,6 +279,9 @@ export default class FocusTaskPlugin extends Plugin {
|
|||||||
const elapsedMs = now - this.timerStartTimestamp;
|
const elapsedMs = now - this.timerStartTimestamp;
|
||||||
const elapsedSeconds = Math.floor(elapsedMs / 1000);
|
const elapsedSeconds = Math.floor(elapsedMs / 1000);
|
||||||
|
|
||||||
|
// If less than 1 second elapsed, no need to sync
|
||||||
|
if (elapsedSeconds < 1) return;
|
||||||
|
|
||||||
if (this.isBreakMode) {
|
if (this.isBreakMode) {
|
||||||
// Break mode: countdown timer
|
// Break mode: countdown timer
|
||||||
this.currentTimerSeconds = Math.max(0, this.pausedTimeRemaining - elapsedSeconds);
|
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
|
// Update displays
|
||||||
this.updateStatusBar();
|
this.updateStatusBar();
|
||||||
this.updateTimerDisplay();
|
this.updateTimerDisplay();
|
||||||
@@ -538,6 +545,9 @@ export default class FocusTaskPlugin 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)
|
||||||
|
// This allows starting fresh next time
|
||||||
|
task.actualMinutes = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user