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 csv
|
||||||
import time
|
import time
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
import zenipy
|
import zenipy
|
||||||
|
@ -34,16 +35,18 @@ def quit_prompt():
|
||||||
else:
|
else:
|
||||||
quit_prompt()
|
quit_prompt()
|
||||||
|
|
||||||
def log_step(text):
|
def log_step(text, start):
|
||||||
# timelog.touch(exist_ok=True)
|
timelog_path = 'log/' + str(start.year) + '-' + format(start.month, '02') + '-' + format(start.day, '02') + '.log'
|
||||||
# with timelog.open('r+') as f:
|
timelog_file = Path(timelog_path)
|
||||||
# pp = PomodoroPrompt(timelog=f)
|
timelog_file.touch(exist_ok=True)
|
||||||
return
|
with timelog_file.open('a') as timelog:
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
def record_task(whatdid, start, end=None):
|
def record_task(whatdid, start, end=None):
|
||||||
if end is None:
|
if end is None:
|
||||||
end = datetime.now(pytz.utc)
|
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 = csv.writer(csvfile)
|
||||||
timewriter.writerow([start, end, whatdid])
|
timewriter.writerow([start, end, whatdid])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue