From cc94fab95f2219549a4d278878453942e64b6deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Mon, 6 Jul 2020 09:40:08 -0400 Subject: [PATCH] Don't try to record pomodoro if we're in a break (start set to none) Also talk a bit more in the CLI, more feedback --- pomodoroprompt.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pomodoroprompt.py b/pomodoroprompt.py index e08eda0..ccb8b76 100644 --- a/pomodoroprompt.py +++ b/pomodoroprompt.py @@ -87,6 +87,11 @@ def main(): whatdid = pomodoro_prompt_report(whatnext) record_task(whatdid, start) log_step('Completed pomodoro: ' + whatdid, start, True) + print('Worked on: ' + whatdid) + + print('Break time!') + # We're taking a break. Clear out task start/end times. + start = None end = datetime.now(pytz.utc) + timedelta(minutes=SHORT_MIN) while datetime.now(pytz.utc) <= end: to_go = end-datetime.now(pytz.utc) @@ -94,15 +99,20 @@ def main(): time.sleep(1) continue except KeyboardInterrupt: + if start is None: + quit_prompt() + continue time_spent = datetime.now(pytz.utc) - start - if time_spent > timedelta(minutes=INTERRUPTED_MIN): - time_spent_str = str_minutes(time_spent) - print('\n{} time spent, save?'.format(time_spent_str)) - choice = input('[y]/n: ').strip() - if choice.lower() in ('y', 'yes', ''): - whatdid = pomodoro_prompt_report(whatnext) - record_task(whatdid, start) - log_step('Incomplete (' + time_spent_str + ') pomodoro: ' + whatdid, start, True) + if time_spent < timedelta(minutes=INTERRUPTED_MIN): + quit_prompt() + continue + time_spent_str = str_minutes(time_spent) + print('\n{} time spent, save?'.format(time_spent_str)) + choice = input('[y]/n: ').strip() + if choice.lower() in ('y', 'yes', ''): + whatdid = pomodoro_prompt_report(whatnext) + record_task(whatdid, start) + log_step('Incomplete (' + time_spent_str + ') pomodoro: ' + whatdid, start, True) quit_prompt() else: print('What did you break?')