MCPcopy Create free account
hub / github.com/TalkingData/owl / actionFilter

Function actionFilter

controller/notify.go:146–159  ·  view source on GitHub ↗
(actions []*types.Action, strategy_event *types.StrategyEvent)

Source from the content-addressed store, hash-verified

144}
145
146func actionFilter(actions []*types.Action, strategy_event *types.StrategyEvent) []*types.Action {
147 filtered := make([]*types.Action, 0)
148 for _, action := range actions {
149 now := time.Now()
150 if !(now.After(generateTime(now, action.BeginTime)) && now.Before(generateTime(now, action.EndTime))) {
151 continue
152 }
153 if !(now.Sub(strategy_event.CreateTime).Minutes() >= float64(action.TimePeriod)) {
154 continue
155 }
156 filtered = append(filtered, action)
157 }
158 return filtered
159}
160
161func generateTime(nowDateTime time.Time, onlyTime string) time.Time {
162 newTime, err := time.Parse("15:04:05", onlyTime)

Callers 1

doAlarmActionFunction · 0.85

Calls 1

generateTimeFunction · 0.85

Tested by

no test coverage detected