Fix exception calculation when started
This commit is contained in:
parent
5526940e61
commit
cbf0fcd25a
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user