From dbcc21c4d5cb1f1defe07ba5e62b2aaed1b24cfa Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Mon, 9 Feb 2015 13:17:25 +0200 Subject: [PATCH] fix for tp actiontrigger id --- engine/storage_sql.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/storage_sql.go b/engine/storage_sql.go index 5ef08fcf0..864cd8c89 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -608,10 +608,14 @@ func (self *SQLStorage) SetTPActionTriggers(tpid string, ats map[string][]*utils tx.Rollback() return err } - for idx, at := range aTriggers { + for _, at := range aTriggers { + id := at.Id + if id == "" { + id = utils.GenUUID() + } saved := tx.Save(TpActionTrigger{ Tpid: tpid, - Tag: atId + strconv.Itoa(idx), + UniqueId: id, ThresholdType: at.ThresholdType, ThresholdValue: at.ThresholdValue, Recurrent: at.Recurrent, @@ -1438,6 +1442,7 @@ func (self *SQLStorage) GetTpActionTriggers(tpid, tag string) (map[string][]*uti } for _, tpAt := range tpActionTriggers { at := &utils.TPActionTrigger{ + Id: tpAt.UniqueId, ThresholdType: tpAt.ThresholdType, ThresholdValue: tpAt.ThresholdValue, Recurrent: tpAt.Recurrent,