Split session time into on/off/unclassified buckets

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 20:58:16 -04:00
parent 6b99804132
commit 7eb2b5dc58
3 changed files with 72 additions and 10 deletions
+3 -1
View File
@@ -249,6 +249,8 @@ func (c *Controller) StartManualCommitment(nextAction, successCondition string,
SessionID: sessionID,
StartedUnix: now.Unix(),
Buckets: map[bucketKey]time.Duration{},
OnTask: map[bucketKey]time.Duration{},
OffTask: map[bucketKey]time.Duration{},
}
seed := c.latestWindow
_ = store.AppendFocus(c.sessionsDir, sessionID, focusEvent(now, seed))
@@ -278,7 +280,7 @@ func (c *Controller) enterReview(outcome string) error {
}
// Flush the final open segment, then freeze accounting.
if c.stats != nil && c.stats.hasLast {
c.stats.Buckets[c.stats.lastKey] += c.clock().Sub(c.stats.lastFocusAt)
c.creditLocked(c.stats.lastKey, c.clock().Sub(c.stats.lastFocusAt))
c.stats.hasLast = false
}
c.runtimeState = next