diff options
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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") |
