Handle no alarm in nojs page
This commit is contained in:
parent
791b577c17
commit
425571d76e
2 changed files with 17 additions and 0 deletions
|
|
@ -30,11 +30,20 @@ func DeclareNoJSRoutes(router *gin.Engine, cfg *config.Config, db *reveil.LevelD
|
|||
return
|
||||
}
|
||||
|
||||
if alarm == nil {
|
||||
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
||||
"noAlarm": true,
|
||||
"isPlaying": player.CommonPlayer != nil,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
nCycles := int(time.Until(*alarm) / (90 * time.Minute))
|
||||
nDays := int(time.Until(*alarm) / (24 * time.Hour))
|
||||
nMinutes := int((time.Until(*alarm) / time.Minute) % 90)
|
||||
|
||||
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
||||
"noAlarm": false,
|
||||
"nextAlarmDate": alarm.Format("Mon 2"),
|
||||
"nextAlarmTime": alarm.Format("15:04"),
|
||||
"sameDay": time.Now().Day() == alarm.Day(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue