Fix appending to CSV and start working on detailed log
This commit is contained in:
parent
57ec262f7d
commit
ee762c15a2
1 changed files with 9 additions and 6 deletions
|
@ -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)
|
||||
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])
|
||||
|
||||
|
|
Loading…
Reference in a new issue