refactor: better check for empty pomodoro client settings

- replace UnsetPomodoroConfig with empty struct check in client commands
- remove unused UnsetPomodoroConfig variable

🤖
This commit is contained in:
Sebastian Mark 2024-10-23 17:35:16 +02:00
parent 188f9ce928
commit 715fe60e1d
2 changed files with 1 additions and 4 deletions

View file

@ -15,6 +15,3 @@ var DefaultPomodoroConfig = models.GoTomatoPomodoroConfig{
LongBreak: 15 * 60,
Sessions: 4,
}
// used to check if client passed a config json
var UnsetPomodoroConfig models.GoTomatoPomodoroConfig

View file

@ -49,7 +49,7 @@ func handleClientCommands(ws *websocket.Conn) {
}
case "updateSettings":
if !pomodoro.IsPomodoroOngoing() {
if clientCommand.PomodoroSettings != shared.UnsetPomodoroConfig {
if clientCommand.PomodoroSettings != (models.GoTomatoPomodoroConfig{}) {
shared.Message.PomodoroSettings = clientCommand.PomodoroSettings
shared.Message.TimeLeft = clientCommand.PomodoroSettings.Work
}