Skip to content

Commit

Permalink
Update Pomodoro timer logic to use fixed values for mode transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyhuang07 committed Nov 17, 2024
1 parent 4fb7d5d commit 507fc83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function startTimer() {
currentTime = -1;
playSoundTimer();
clearInterval(timer);
if (mode === 1 && numOfPomodoros !== (pomNo.value - 1)) { // if was in Pomodoro Mode (go to Short)
if (mode === 1 && numOfPomodoros !== 3) { // if was in Pomodoro Mode (go to Short)
mode = 2;
countdown.innerHTML = formatTime(shortTime);
document.title = formatTime(shortTime) + " - PomodoPro";
Expand All @@ -139,7 +139,7 @@ function startTimer() {
startButton.style.display = "block";
stopButton.style.display = "none";
}
else if (mode === 2 && numOfPomodoros !== pomNo.value) { // if was in Short Time Mode (return to Default)
else if (mode === 2 && numOfPomodoros !== 4) { // if was in Short Time Mode (return to Default)
numOfPomodoros++;
mode = 1;
countdown.innerHTML = formatTime(defaultTime);
Expand All @@ -151,7 +151,7 @@ function startTimer() {
startButton.style.display = "block";
stopButton.style.display = "none";
}
else if (mode === 1 && numOfPomodoros === (pomNo.value - 1)) { // if was in Pomodoro Mode (go to Long)
else if (mode === 1 && numOfPomodoros === 3) { // if was in Pomodoro Mode (go to Long)
numOfPomodoros++;
mode = 3;
countdown.innerHTML = formatTime(longTime);
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function startTimer() {
currentTime = -1;
playSoundTimer();
clearInterval(timer);
if (mode === 1 && numOfPomodoros !== (pomNo.value - 1)) { // if was in Pomodoro Mode (go to Short)
if (mode === 1 && numOfPomodoros !== 3) { // if was in Pomodoro Mode (go to Short)
mode = 2;
countdown.innerHTML = formatTime(shortTime);
document.title = formatTime(shortTime) + " - PomodoPro";
Expand All @@ -171,7 +171,7 @@ function startTimer() {
shortBreak.style.color = "black";
startButton.style.display = "block";
stopButton.style.display = "none";
} else if (mode === 2 && numOfPomodoros !== pomNo.value) { // if was in Short Time Mode (return to Default)
} else if (mode === 2 && numOfPomodoros !== 4) { // if was in Short Time Mode (return to Default)
numOfPomodoros++
mode = 1;
countdown.innerHTML = formatTime(defaultTime);
Expand All @@ -182,7 +182,7 @@ function startTimer() {
shortBreak.style.color = "white";
startButton.style.display = "block";
stopButton.style.display = "none";
} else if (mode === 1 && numOfPomodoros === (pomNo.value - 1)) { // if was in Pomodoro Mode (go to Long)
} else if (mode === 1 && numOfPomodoros === 3) { // if was in Pomodoro Mode (go to Long)
numOfPomodoros++
mode = 3;
countdown.innerHTML = formatTime(longTime);
Expand Down

0 comments on commit 507fc83

Please sign in to comment.