summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorhmj6502 <hashim@hmj6502.com>2025-12-28 15:38:17 +0000
committerhmj6502 <hashim@hmj6502.com>2025-12-28 20:09:45 +0000
commitd1066e7a26d8da0d1ed2e15997a485879e46611d (patch)
tree1fea05df5fd2d5205388827cc92f196fd3f44db1 /main.py
parentb5d036762d9e4566f81e18708414fd306db6a1bc (diff)
downloadlock-n-log-d1066e7a26d8da0d1ed2e15997a485879e46611d.tar.gz
lock-n-log-d1066e7a26d8da0d1ed2e15997a485879e46611d.tar.bz2
lock-n-log-d1066e7a26d8da0d1ed2e15997a485879e46611d.zip
stop/start & rest bank complete on stopwatch
- cumulative time wasn't too bad to add actually - one id per session added - change formatting.py so that it only counts time that is of type 'focus' as time to put on chart - add pie chart and time in minutes rather than seconds to display.py
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/main.py b/main.py
index cbdc9e3..1c3846e 100755
--- a/main.py
+++ b/main.py
@@ -11,7 +11,7 @@ import formatting as f
print("welcome to lock-n-log, the best way to organise and analyse your focus time!")
-ratio = 1 # default for now
+ratio = 1/3 # default for now
sesh_type = "focus"
print("tag for session? ", end="", flush=True)
@@ -41,11 +41,12 @@ else:
input()
sesh_list = []
-elapsed, rest, start = timers.timer(timer_length, ratio, 0)
+elapsed_total = 0
+elapsed, rest, start = timers.timer(timer_length, ratio)
+session_id = hashlib.sha256(str(start).encode('utf8')).hexdigest()
while rest > 0:
-# print("\nneed to rest " + str(int(rest)))
session = OrderedDict()
- session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
+ session["id"] = session_id
session["date"] = start.strftime("%Y-%m-%d")
session["start"] = start.strftime("%H:%M:%S")
session["elapsed"] = int(elapsed)
@@ -54,6 +55,7 @@ while rest > 0:
session["timer"] = timer
session["ratio"] = ratio
sesh_list.append(session)
+ elapsed_total += elapsed
sesh_type = "rest"
elapsed, dontcare, start = timers.timer(rest, 0, 0)
@@ -62,7 +64,7 @@ while rest > 0:
else:
rest -= elapsed
session = OrderedDict()
- session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
+ session["id"] = session_id
session["date"] = start.strftime("%Y-%m-%d")
session["start"] = start.strftime("%H:%M:%S")
session["elapsed"] = int(elapsed)
@@ -73,13 +75,13 @@ while rest > 0:
sesh_list.append(session)
sesh_type = "focus"
- elapsed, rest, start = timers.timer(0, ratio, rest)
+ elapsed, rest, start = timers.timer(0, ratio, rest, elapsed_total)
if rest == 0:
break
print("\nfocus session finished!\nlogging...")
session = OrderedDict()
-session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
+session["id"] = session_id
session["date"] = start.strftime("%Y-%m-%d")
session["start"] = start.strftime("%H:%M:%S")
session["elapsed"] = int(elapsed)
@@ -90,6 +92,5 @@ session["ratio"] = ratio
sesh_list.append(session)
for session in sesh_list:
- print(session)
-
-#f.sesh_to_log(session, "main.csv")
+# print(session)
+ f.sesh_to_log(session, "main.csv")