From 96edda1f590e54865f1976ae9e9d39de68e8b9b9 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Tue, 27 Apr 2021 15:42:25 +0200 Subject: [PATCH] check if we're in an active sprint --- timewarrior.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/timewarrior.py b/timewarrior.py index bd6ca57..d5e9042 100755 --- a/timewarrior.py +++ b/timewarrior.py @@ -33,10 +33,10 @@ RESULTS = sorted(map( x['tags'] }, TW.summary()), key=lambda x: x['start']) +IS_ACTIVE = len(list(filter(lambda x: "end" not in x, TW.summary()))) > 0 -print("⌛ {}\n-----".format( - str(functools.reduce(lambda total, x: total + x['end'] - x['start'], RESULTS, timedelta())).split(sep='.', - maxsplit=1)[0])) +print("⏳" if IS_ACTIVE else "⌛", str(functools.reduce(lambda total, x: total + x['end'] - x['start'], RESULTS, timedelta())).split(sep='.', maxsplit=1)[0], "✓" if not IS_ACTIVE else "") +print("---") print( " | font=monospace | size=8\n".join( map(