refactor: move event_types into types/ pkg, make methods public, small fixes

This commit is contained in:
2025-08-01 18:16:00 -05:00
parent 21358b73e1
commit 26b8892ff6
7 changed files with 63 additions and 60 deletions

View File

@@ -93,7 +93,7 @@ func (b eventListenerBuilder3) ExceptionDates(t time.Time, tl ...time.Time) even
}
func (b eventListenerBuilder3) ExceptionRange(start, end time.Time) eventListenerBuilder3 {
b.eventListener.exceptionRanges = append(b.eventListener.exceptionRanges, types.TimeRange{start, end})
b.eventListener.exceptionRanges = append(b.eventListener.exceptionRanges, types.TimeRange{Start: start, End: end})
return b
}
@@ -153,22 +153,22 @@ func callEventListeners(app *App, msg ws.ChanMsg) {
for _, l := range listeners {
// Check conditions
if c := checkWithinTimeRange(l.betweenStart, l.betweenEnd); c.fail {
if c := CheckWithinTimeRange(l.betweenStart, l.betweenEnd); c.fail {
continue
}
if c := checkThrottle(l.throttle, l.lastRan); c.fail {
if c := CheckThrottle(l.throttle, l.lastRan); c.fail {
continue
}
if c := checkExceptionDates(l.exceptionDates); c.fail {
if c := CheckExceptionDates(l.exceptionDates); c.fail {
continue
}
if c := checkExceptionRanges(l.exceptionRanges); c.fail {
if c := CheckExceptionRanges(l.exceptionRanges); c.fail {
continue
}
if c := checkEnabledEntity(app.state, l.enabledEntities); c.fail {
if c := CheckEnabledEntity(app.state, l.enabledEntities); c.fail {
continue
}
if c := checkDisabledEntity(app.state, l.disabledEntities); c.fail {
if c := CheckDisabledEntity(app.state, l.disabledEntities); c.fail {
continue
}