fix: preserve active break over reload checkpoint (Closes #1394)
This commit is contained in:
1 parent
553a01217a
commit
978351dff2
2 files changed
+33
-3
No files matched your search
@@ -117,16 +117,17 @@ function createTodayTimer({ storage, getLogin, now = () => Date.now(), onChange
|
||||
}
|
||||
if (!ledger[identity] || ledger[identity].elapsed_ms !== Math.floor(Number(elapsedMs))) return false;
|
||||
const state = read();
|
||||
const keepBreak = validBreak(state)?.identity === identity;
|
||||
state.active_identity = identity;
|
||||
state.entries = ledger;
|
||||
state.entries[identity].started_at = running ? now() : null;
|
||||
state.entries[identity].running = Boolean(running);
|
||||
state.entries[identity].started_at = running && !keepBreak ? now() : null;
|
||||
state.entries[identity].running = Boolean(running) && !keepBreak;
|
||||
state.away_at = null;
|
||||
state.pending_interruption = null;
|
||||
state.attention_interruption = null;
|
||||
state.search_interruption = null;
|
||||
state.detour_interruption = null;
|
||||
if(running || validBreak(state)?.identity !== identity) state.timed_break=null;
|
||||
if (!keepBreak) state.timed_break = null;
|
||||
return write(state);
|
||||
},
|
||||
activate(identity) {
|
||||
|
||||
Reference in new issue
Block a user