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:
parent
cb6616f400
commit
5bf9753dce
2 changed files with 11 additions and 15 deletions
|
@ -2,7 +2,6 @@ package pomodoro
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
|
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
|
||||||
// "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,11 +46,12 @@ func RunPomodoro() {
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetPomodoro resets the running Pomodoro timer.
|
// Stops and resets the running Pomodoro
|
||||||
func ResetPomodoro() {
|
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
|
pomodoroResetChannel <- true
|
||||||
shared.Message = shared.ResetToDefault()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func PausePomodoro() {
|
func PausePomodoro() {
|
||||||
|
|
|
@ -4,10 +4,7 @@ import (
|
||||||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Message = ResetToDefault()
|
var Message = models.ServerMessage{
|
||||||
|
|
||||||
func ResetToDefault() models.ServerMessage {
|
|
||||||
return models.ServerMessage{
|
|
||||||
Mode: "Idle",
|
Mode: "Idle",
|
||||||
PomodoroSettings: DefaultPomodoroConfig,
|
PomodoroSettings: DefaultPomodoroConfig,
|
||||||
Session: 0,
|
Session: 0,
|
||||||
|
@ -15,6 +12,5 @@ func ResetToDefault() models.ServerMessage {
|
||||||
Ongoing: false,
|
Ongoing: false,
|
||||||
Paused: false,
|
Paused: false,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var PomodoroPassword string
|
var PomodoroPassword string
|
||||||
|
|
Loading…
Reference in a new issue