tweek: include time-only sessions not in git events

This commit is contained in:
Paul Trowbridge 2026-05-14 08:40:51 -04:00
parent bf91831284
commit 301dbbbc82

View File

@ -188,13 +188,27 @@ def cmd_week(args):
since = args.since or _default_since()
events = list(_scan_git(since))
totals = _tid_totals()
if not events:
print(f"no task events since {since}"); return
by_day = defaultdict(list)
git_tids = set()
for ts, kind, tid, file, desc in events:
day = ts[:10]
by_day[day].append((ts, kind, tid, file, desc))
marker = {"done": "[x]", "new": "[ ]", "done+new": "[+]", "reopen": "[o]"}
git_tids.add(tid)
seen_tid_days = set()
for r in read_rows():
if not r["stopped_at"]:
continue
day = r["started_at"][:10]
if day < since[:10]:
continue
tid = r["tid"]
if tid in git_tids or (day, tid) in seen_tid_days:
continue
seen_tid_days.add((day, tid))
by_day[day].append((r["started_at"], "time", tid, r["file"], r["description"]))
if not by_day:
print(f"no task events since {since}"); return
marker = {"done": "[x]", "new": "[ ]", "done+new": "[+]", "reopen": "[o]", "time": "[-]"}
n_done = n_new = total_secs = 0
counted_tids = set()
print(f"Week since {since}\n")