Fix exception calculation when started

This commit is contained in:
nemunaire 2022-12-23 12:43:58 +01:00
parent 5526940e61
commit cbf0fcd25a
1 changed files with 2 additions and 2 deletions

View File

@ -167,7 +167,7 @@ func (a *AlarmRepeated) FillExcepts(cfg *config.Config, db *LevelDBStorage) erro
now := time.Now()
for _, exception := range exceptions {
if now.After(time.Time(*exception.Start)) {
if now.After(time.Time(*exception.End)) {
continue
}
@ -175,7 +175,7 @@ func (a *AlarmRepeated) FillExcepts(cfg *config.Config, db *LevelDBStorage) erro
for t := time.Time(*exception.Start); end.After(t); t = t.AddDate(0, 0, 1) {
if t.Weekday() == a.Weekday {
a.Excepts = append(a.Excepts, time.Date(t.Year(), t.Month(), t.Day(), time.Time(*a.StartTime).Hour(), time.Time(*a.StartTime).Minute(), time.Time(*a.StartTime).Second(), 0, cfg.Timezone.GetLocation()))
t.AddDate(0, 0, 6)
t = t.AddDate(0, 0, 6)
}
}
}