mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 13:49:53 +05:00
generate uuid for action triggers
This commit is contained in:
@@ -202,7 +202,7 @@ func (self *ApierV1) SetAccount(attr utils.AttrSetAccount, reply *string) error
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
ub.ActionTriggers = atrs
|
||||
ub.ActionTriggers = atrs.Clone()
|
||||
ub.InitCounters()
|
||||
}
|
||||
if attr.AllowNegative != nil {
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
|
||||
type ActionTrigger struct {
|
||||
Id string // for visual identification
|
||||
Uuid string
|
||||
ThresholdType string //*min_event_counter, *max_event_counter, *min_balance_counter, *max_balance_counter, *min_balance, *max_balance, *exp_balance
|
||||
// stats: *min_asr, *max_asr, *min_acd, *max_acd, *min_tcd, *max_tcd, *min_acc, *max_acc, *min_tcc, *max_tcc, *min_ddc, *max_ddc
|
||||
ThresholdValue float64
|
||||
@@ -234,7 +235,7 @@ func (atrs ActionTriggers) Clone() ActionTriggers {
|
||||
var newATriggers ActionTriggers
|
||||
for _, atr := range atrs {
|
||||
newAtr := atr.Clone()
|
||||
newAtr.Id = utils.GenUUID()
|
||||
newAtr.Uuid = utils.GenUUID()
|
||||
newATriggers = append(newATriggers, newAtr)
|
||||
}
|
||||
return newATriggers
|
||||
|
||||
@@ -615,6 +615,7 @@ func (tpr *TpReader) LoadActionTriggers() (err error) {
|
||||
return err
|
||||
}
|
||||
atrs[idx] = &ActionTrigger{
|
||||
Id: key,
|
||||
ThresholdType: atr.ThresholdType,
|
||||
ThresholdValue: atr.ThresholdValue,
|
||||
Recurrent: atr.Recurrent,
|
||||
@@ -754,6 +755,8 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *TpAccountAction) error
|
||||
minSleep, _ := utils.ParseDurationWithSecs(apiAtr.MinSleep)
|
||||
expTime, _ := utils.ParseDate(apiAtr.BalanceExpirationDate)
|
||||
atrs[idx] = &ActionTrigger{
|
||||
Id: key,
|
||||
Uuid: utils.GenUUID(),
|
||||
ThresholdType: apiAtr.ThresholdType,
|
||||
ThresholdValue: apiAtr.ThresholdValue,
|
||||
Recurrent: apiAtr.Recurrent,
|
||||
@@ -964,6 +967,8 @@ func (tpr *TpReader) LoadCdrStatsFiltered(tag string, save bool) (err error) {
|
||||
minSleep, _ := utils.ParseDurationWithSecs(apiAtr.MinSleep)
|
||||
expTime, _ := utils.ParseDate(apiAtr.BalanceExpirationDate)
|
||||
atrs[idx] = &ActionTrigger{
|
||||
Id: triggerTag,
|
||||
Uuid: utils.GenUUID(),
|
||||
ThresholdType: apiAtr.ThresholdType,
|
||||
ThresholdValue: apiAtr.ThresholdValue,
|
||||
Recurrent: apiAtr.Recurrent,
|
||||
|
||||
Reference in New Issue
Block a user