commit b6715dba804f523ea454f87e7f8b84a44b8f7e48
parent 4ba2eb1a387362ea318f34317e34bb3e2b765b3c
Author: tongong <tongong@gmx.net>
Date: Sat, 26 Jun 2021 19:38:34 +0200
added average view
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/timetracker-report b/timetracker-report
@@ -98,3 +98,21 @@ if today in days:
if days[today][program] >= 60:
tgIn.append([program, days[today][program]])
printGraph(tgIn)
+
+# average
+print()
+printHeading("# average")
+# get total number of days
+dayNum = (datetime.today() - \
+ datetime.strptime(list(days.keys())[0], "%Y-%m-%d")).days + 1
+tgIn = [] # graph input
+for program in programs:
+ ptime = 0
+ for day in days:
+ for p in days[day]:
+ if p == program:
+ ptime += days[day][program] / dayNum
+ if ptime >= 60:
+ tgIn.append([program, ptime]);
+tgIn = sorted(tgIn, key=lambda x: x[1], reverse=True)
+printGraph(tgIn)