Compare commits
2 Commits
42c85f4468
...
301dbbbc82
| Author | SHA1 | Date | |
|---|---|---|---|
| 301dbbbc82 | |||
| bf91831284 |
@ -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")
|
||||||
@ -204,7 +218,7 @@ def cmd_week(args):
|
|||||||
for ts, kind, tid, file, desc in by_day[day]:
|
for ts, kind, tid, file, desc in by_day[day]:
|
||||||
t = totals.get(tid, 0)
|
t = totals.get(tid, 0)
|
||||||
dur = _fmt_dur(t) if t else " "
|
dur = _fmt_dur(t) if t else " "
|
||||||
print(f" {marker.get(kind,'? ')} {tid:<24} {dur:>6} {file} — {desc[:60]}")
|
print(f" {marker.get(kind,'? ')} {tid:<24} {dur:>6} {file:<36} {desc[:60]}")
|
||||||
if kind in ("done", "done+new"): n_done += 1
|
if kind in ("done", "done+new"): n_done += 1
|
||||||
if kind in ("new", "done+new"): n_new += 1
|
if kind in ("new", "done+new"): n_new += 1
|
||||||
if tid not in counted_tids:
|
if tid not in counted_tids:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user