Fixed Focus time not adding time properly
This commit is contained in:
16
main.js
16
main.js
@@ -2,7 +2,6 @@
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
/* Build version 1.0.1 */
|
||||
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
@@ -496,6 +495,8 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
||||
this.isBreakMode = false;
|
||||
this.activeTaskId = null;
|
||||
this.pomodoroCount = 0;
|
||||
// Focus time tracking (in seconds for accuracy)
|
||||
this.focusSecondsToday = 0;
|
||||
// Status bar element
|
||||
this.statusBarEl = null;
|
||||
}
|
||||
@@ -544,8 +545,10 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
||||
const loaded = await this.loadData();
|
||||
this.data = Object.assign({}, DEFAULT_DATA, (loaded == null ? void 0 : loaded.data) || {});
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, (loaded == null ? void 0 : loaded.settings) || {});
|
||||
this.focusSecondsToday = (this.data.totalFocusMinutesToday || 0) * 60;
|
||||
}
|
||||
async saveAllData() {
|
||||
this.data.totalFocusMinutesToday = Math.floor(this.focusSecondsToday / 60);
|
||||
await this.saveData({
|
||||
settings: this.settings,
|
||||
data: this.data
|
||||
@@ -563,6 +566,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
||||
}
|
||||
this.data.completedToday = 0;
|
||||
this.data.totalFocusMinutesToday = 0;
|
||||
this.focusSecondsToday = 0;
|
||||
this.data.lastActiveDate = today;
|
||||
this.saveAllData();
|
||||
}
|
||||
@@ -667,6 +671,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
||||
this.timerInterval = window.setInterval(() => {
|
||||
this.currentTimerSeconds++;
|
||||
task.actualMinutes = Math.floor(this.currentTimerSeconds / 60);
|
||||
this.focusSecondsToday++;
|
||||
this.updateStatusBar();
|
||||
this.updateTimerDisplay();
|
||||
if (this.currentTimerSeconds === task.estimatedMinutes * 60) {
|
||||
@@ -690,11 +695,13 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
||||
this.isTimerRunning = true;
|
||||
this.refreshView();
|
||||
this.updateStatusBar();
|
||||
let secondsWorked = 0;
|
||||
this.timerInterval = window.setInterval(() => {
|
||||
this.currentTimerSeconds--;
|
||||
if (!this.isBreakMode) {
|
||||
task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60);
|
||||
this.data.totalFocusMinutesToday = Math.floor(this.data.totalFocusMinutesToday + 1 / 60);
|
||||
secondsWorked++;
|
||||
task.actualMinutes = Math.floor(secondsWorked / 60);
|
||||
this.focusSecondsToday++;
|
||||
}
|
||||
this.updateStatusBar();
|
||||
this.updateTimerDisplay();
|
||||
@@ -756,6 +763,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
||||
this.currentTimerSeconds--;
|
||||
if (task && !this.isBreakMode) {
|
||||
task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60);
|
||||
this.focusSecondsToday++;
|
||||
}
|
||||
this.updateStatusBar();
|
||||
this.updateTimerDisplay();
|
||||
@@ -927,7 +935,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
|
||||
pendingCount: pending.length,
|
||||
completedToday: this.data.completedToday,
|
||||
totalEstimatedMinutes: totalEstimate,
|
||||
totalFocusMinutesToday: Math.floor(this.data.totalFocusMinutesToday),
|
||||
totalFocusMinutesToday: Math.floor(this.focusSecondsToday / 60),
|
||||
streak: this.data.streak,
|
||||
pomodorosCompleted: this.data.pomodorosCompleted,
|
||||
avgAccuracy: Math.round(avgAccuracy * 100)
|
||||
|
||||
Reference in New Issue
Block a user