summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py55
1 files changed, 48 insertions, 7 deletions
diff --git a/main.py b/main.py
index c59ac4c..cbdc9e3 100755
--- a/main.py
+++ b/main.py
@@ -11,6 +11,9 @@ 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
+sesh_type = "focus"
+
print("tag for session? ", end="", flush=True)
tag = input()
if tag == "":
@@ -37,18 +40,56 @@ else:
print("whenever you're ready, press enter to start", end="", flush=True)
input()
-elapsed, start = timers.timer(timer_length)
+sesh_list = []
+elapsed, rest, start = timers.timer(timer_length, ratio, 0)
+while rest > 0:
+# print("\nneed to rest " + str(int(rest)))
+ session = OrderedDict()
+ session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
+ session["date"] = start.strftime("%Y-%m-%d")
+ session["start"] = start.strftime("%H:%M:%S")
+ session["elapsed"] = int(elapsed)
+ session["type"] = sesh_type
+ session["tag"] = tag
+ session["timer"] = timer
+ session["ratio"] = ratio
+ sesh_list.append(session)
+
+ sesh_type = "rest"
+ elapsed, dontcare, start = timers.timer(rest, 0, 0)
+ if elapsed >= rest: # if exceeded break bank, then focus session ended
+ break
+ else:
+ rest -= elapsed
+ session = OrderedDict()
+ session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
+ session["date"] = start.strftime("%Y-%m-%d")
+ session["start"] = start.strftime("%H:%M:%S")
+ session["elapsed"] = int(elapsed)
+ session["type"] = sesh_type
+ session["tag"] = tag
+ session["timer"] = timer
+ session["ratio"] = ratio
+ sesh_list.append(session)
+
+ sesh_type = "focus"
+ elapsed, rest, start = timers.timer(0, ratio, rest)
+ if rest == 0:
+ break
print("\nfocus session finished!\nlogging...")
session = OrderedDict()
session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
session["date"] = start.strftime("%Y-%m-%d")
-session["start"] = start.strftime("%H:%M")
-session["elapsed"] = int(elapsed.total_seconds())
-session["type"] = "focus"
+session["start"] = start.strftime("%H:%M:%S")
+session["elapsed"] = int(elapsed)
+session["type"] = sesh_type
session["tag"] = tag
session["timer"] = timer
-session["ratio"] = 0.2
-#print(session)
+session["ratio"] = ratio
+sesh_list.append(session)
+
+for session in sesh_list:
+ print(session)
-f.sesh_to_log(session, "lock-n-log.csv")
+#f.sesh_to_log(session, "main.csv")