Skip to content

Commit

Permalink
Refactor (#74)
Browse files Browse the repository at this point in the history
* fix : pomodoro_timer refactored

* fix : autopep8

* doc : README.md reference section updated

* fix : minor bug in pomodoro_function fixed

* doc : extra new line removed in README.md
  • Loading branch information
sepandhaghighi authored Dec 13, 2023
1 parent a355372 commit e3ef90b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ Just fill an issue and describe it. We'll check it ASAP!

<blockquote>3- <a href="https://www.mediacollege.com/">Media College</a></blockquote>

<blockquote>4- <a href="https://en.wikipedia.org/wiki/Pomodoro_Technique">Pomodoro Technique</a></blockquote>


## Show your support
Expand Down
25 changes: 10 additions & 15 deletions mytimer/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,25 +387,20 @@ def pomodoro_timer(timer_func, **params):
:type params: dict
:return: None
"""
counter = 0
end_flag = False
break_params = load_program_params("short-break")
break_name = "Short break"
while True:
short_break_params = load_program_params("short-break")
long_break_params = load_program_params("long-break")
for index in range(4):
work_params = params.copy()
work_params["message"] += " {0}/{1}".format(counter + 1, 4)
work_params["message"] += " {0}/{1}".format(index + 1, 4)
timer_func(**work_params)
counter += 1
if counter == 4:
break_params = load_program_params("long-break")
break_name = "Long break"
end_flag = True
_ = input(NEXT_PROGRAM_MESSAGE.format(break_name))
timer_func(**break_params)
if end_flag:
if index == 3:
break
_ = input(NEXT_PROGRAM_MESSAGE.format("Short break"))
timer_func(**short_break_params)
_ = input(NEXT_PROGRAM_MESSAGE.format(
"Work {0}/{1}".format(counter + 1, 4)))
"Work {0}/{1}".format(index + 2, 4)))
_ = input(NEXT_PROGRAM_MESSAGE.format("Long break"))
timer_func(**long_break_params)


def run_timer(args):
Expand Down

0 comments on commit e3ef90b

Please sign in to comment.