=stop timer

=displayV
This commit is contained in:
Linux User 2023-12-15 12:34:01 +00:00
parent 5829f22163
commit b5195ed4a3
13 changed files with 126 additions and 37 deletions

View file

@ -88,6 +88,8 @@ func (w *Webapp) LoadRunning(c *gin.Context) {
return
}
}
c.JSON(http.StatusNoContent, "")
}
func (w *Webapp) LoadHeats(c *gin.Context) {
@ -130,6 +132,20 @@ func (w *Webapp) StartHeatTimer(c *gin.Context) {
c.JSON(http.StatusOK, w.Stream.Duration)
}
func (w *Webapp) StopHeatTimer(c *gin.Context) {
if !w.Stream.Start {
c.JSON(http.StatusOK, w.Stream.Duration)
return
}
stopHeat(w.DB, *w.Stream.Heat)
w.Stream.Start = false
w.Stream.Duration = 0
log.Printf("start timer %s", w.Stream.Duration)
c.JSON(http.StatusOK, w.Stream.Duration)
}
func loadHeats(db *scribble.Driver) []Heat {
records, err := db.ReadAll("Heat")
if err != nil {