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
188f9ce928
commit
715fe60e1d
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