fix: ResetPomodoro() resets to current settings not server defaults

- reset shared.Message fields to current values in `ResetPomodoro()` function
- remove `ResetToDefault()`
This commit is contained in:
Sebastian Mark 2024-10-22 10:39:53 +02:00
parent cb6616f400
commit 5bf9753dce
2 changed files with 11 additions and 15 deletions

View file

@ -2,7 +2,6 @@ package pomodoro
import (
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
// "git.smsvc.net/pomodoro/GoTomato/pkg/models"
"sync"
)
@ -47,11 +46,12 @@ func RunPomodoro() {
mu.Unlock()
}
// ResetPomodoro resets the running Pomodoro timer.
// Stops and resets the running Pomodoro
func ResetPomodoro() {
// Send a reset signal to stop any running timers
shared.Message.Mode = "Idle"
shared.Message.Session = 0
shared.Message.TimeLeft = shared.Message.PomodoroSettings.Work
pomodoroResetChannel <- true
shared.Message = shared.ResetToDefault()
}
func PausePomodoro() {

View file

@ -4,10 +4,7 @@ import (
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
)
var Message = ResetToDefault()
func ResetToDefault() models.ServerMessage {
return models.ServerMessage{
var Message = models.ServerMessage{
Mode: "Idle",
PomodoroSettings: DefaultPomodoroConfig,
Session: 0,
@ -15,6 +12,5 @@ func ResetToDefault() models.ServerMessage {
Ongoing: false,
Paused: false,
}
}
var PomodoroPassword string