mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
action triggers expiration and activation times
This commit is contained in:
@@ -36,6 +36,8 @@ type ActionTrigger struct {
|
||||
ThresholdValue float64
|
||||
Recurrent bool // reset excuted flag each run
|
||||
MinSleep time.Duration // Minimum duration between two executions in case of recurrent triggers
|
||||
ExpirationDate time.Time
|
||||
ActivationDate time.Time
|
||||
BalanceId string
|
||||
BalanceType string // *monetary/*voice etc
|
||||
BalanceDirections utils.StringMap // filter for balance
|
||||
@@ -188,6 +190,14 @@ func (at *ActionTrigger) Equals(oat *ActionTrigger) bool {
|
||||
return at.ID == oat.ID && at.UniqueID == oat.UniqueID
|
||||
}
|
||||
|
||||
func (at *ActionTrigger) IsActive(t time.Time) bool {
|
||||
return at.ActivationDate.IsZero() || t.After(at.ActivationDate)
|
||||
}
|
||||
|
||||
func (at *ActionTrigger) IsExpired(t time.Time) bool {
|
||||
return !at.ExpirationDate.IsZero() && t.After(at.ExpirationDate)
|
||||
}
|
||||
|
||||
// Structure to store actions according to weight
|
||||
type ActionTriggers []*ActionTrigger
|
||||
|
||||
|
||||
Reference in New Issue
Block a user