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:
parent
48f531ffca
commit
a6b3444068
2 changed files with 1 additions and 4 deletions
|
@ -15,6 +15,3 @@ var DefaultPomodoroConfig = models.GoTomatoPomodoroConfig{
|
||||||
LongBreak: 15 * 60,
|
LongBreak: 15 * 60,
|
||||||
Sessions: 4,
|
Sessions: 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to check if client passed a config json
|
|
||||||
var UnsetPomodoroConfig models.GoTomatoPomodoroConfig
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ func handleClientCommands(ws *websocket.Conn) {
|
||||||
}
|
}
|
||||||
case "updateSettings":
|
case "updateSettings":
|
||||||
if !pomodoro.IsPomodoroOngoing() {
|
if !pomodoro.IsPomodoroOngoing() {
|
||||||
if clientCommand.PomodoroSettings != shared.UnsetPomodoroConfig {
|
if clientCommand.PomodoroSettings != (models.GoTomatoPomodoroConfig{}) {
|
||||||
shared.Message.PomodoroSettings = clientCommand.PomodoroSettings
|
shared.Message.PomodoroSettings = clientCommand.PomodoroSettings
|
||||||
shared.Message.TimeLeft = clientCommand.PomodoroSettings.Work
|
shared.Message.TimeLeft = clientCommand.PomodoroSettings.Work
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue