From bbf11c1bb166de1d3d96f66243995fa7c3a513b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Mon, 6 Jul 2020 09:29:28 -0400 Subject: [PATCH] If less than a minute, go straight to quit prompt without offer to record partial time --- pomodoroprompt.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pomodoroprompt.py b/pomodoroprompt.py index 482b45b..e08eda0 100644 --- a/pomodoroprompt.py +++ b/pomodoroprompt.py @@ -94,13 +94,15 @@ def main(): time.sleep(1) continue except KeyboardInterrupt: - time_spent = str_minutes(datetime.now(pytz.utc) - start) - print('\n{} time spent, save?'.format(time_spent)) - 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 + ') pomodoro: ' + whatdid, start, True) + 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) quit_prompt() else: print('What did you break?')