tweek: include time-only sessions not in git events
This commit is contained in:
parent
bf91831284
commit
301dbbbc82
@ -188,13 +188,27 @@ def cmd_week(args):
|
|||||||
since = args.since or _default_since()
|
since = args.since or _default_since()
|
||||||
events = list(_scan_git(since))
|
events = list(_scan_git(since))
|
||||||
totals = _tid_totals()
|
totals = _tid_totals()
|
||||||
if not events:
|
|
||||||
print(f"no task events since {since}"); return
|
|
||||||
by_day = defaultdict(list)
|
by_day = defaultdict(list)
|
||||||
|
git_tids = set()
|
||||||
for ts, kind, tid, file, desc in events:
|
for ts, kind, tid, file, desc in events:
|
||||||
day = ts[:10]
|
day = ts[:10]
|
||||||
by_day[day].append((ts, kind, tid, file, desc))
|
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
|
n_done = n_new = total_secs = 0
|
||||||
counted_tids = set()
|
counted_tids = set()
|
||||||
print(f"Week since {since}\n")
|
print(f"Week since {since}\n")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user