diff --git a/pomodoroprompt.py b/pomodoroprompt.py index c0fb640..6988453 100644 --- a/pomodoroprompt.py +++ b/pomodoroprompt.py @@ -1,6 +1,7 @@ import csv import time from datetime import datetime, timedelta +from pathlib import Path import pytz import zenipy @@ -34,16 +35,18 @@ def quit_prompt(): else: quit_prompt() -def log_step(text): - # timelog.touch(exist_ok=True) - # with timelog.open('r+') as f: - # pp = PomodoroPrompt(timelog=f) - return +def log_step(text, start): + timelog_path = 'log/' + str(start.year) + '-' + format(start.month, '02') + '-' + format(start.day, '02') + '.log' + timelog_file = Path(timelog_path) + timelog_file.touch(exist_ok=True) + with timelog_file.open('a') as timelog: + + return def record_task(whatdid, start, end=None): if end is None: end = datetime.now(pytz.utc) - with open('timelog.csv', 'w', newline='') as csvfile: + with open('timelog.csv', 'a', newline='') as csvfile: timewriter = csv.writer(csvfile) timewriter.writerow([start, end, whatdid])