diff --git a/engine/model_converters.go b/engine/model_converters.go index 6bb11f29b..058ea73f8 100644 --- a/engine/model_converters.go +++ b/engine/model_converters.go @@ -215,7 +215,7 @@ func APItoModelActionTrigger(ats *utils.TPActionTriggers) (result []TpActionTrig for _, at := range ats.ActionTriggers { result = append(result, TpActionTrigger{ Tpid: ats.TPid, - Tag: ats.ActionTriggersId, + Tag: at.Id, UniqueId: at.UniqueID, ThresholdType: at.ThresholdType, ThresholdValue: at.ThresholdValue, diff --git a/engine/model_helpers_test.go b/engine/model_helpers_test.go index 84b74670a..d8edf26cb 100644 --- a/engine/model_helpers_test.go +++ b/engine/model_helpers_test.go @@ -551,6 +551,8 @@ func TestTPActionPlanAsExportSlice(t *testing.T) { ActionTriggersId: "STANDARD_TRIGGERS", ActionTriggers: []*utils.TPActionTrigger{ &utils.TPActionTrigger{ + Id: "STANDARD_TRIGGERS", + UniqueID: "1", ThresholdType: "*min_balance", ThresholdValue: 2.0, Recurrent: false, @@ -570,6 +572,8 @@ func TestTPActionPlanAsExportSlice(t *testing.T) { ActionsId: "LOG_WARNING", Weight: 10}, &utils.TPActionTrigger{ + Id: "STANDARD_TRIGGERS", + UniqueID: "2", ThresholdType: "*max_event_counter", ThresholdValue: 5.0, Recurrent: false, @@ -591,8 +595,8 @@ func TestTPActionPlanAsExportSlice(t *testing.T) { }, } expectedSlc := [][]string{ - []string{"STANDARD_TRIGGERS", "", "*min_balance", "2", "false", "0", "b1", "*monetary", "*out", "call", "", "special1", "SHARED_1", "*never", "T1", "0", "false", "0", "LOG_WARNING", "10"}, - []string{"STANDARD_TRIGGERS", "", "*max_event_counter", "5", "false", "0", "b2", "*monetary", "*out", "call", "FS_USERS", "special1", "SHARED_1", "*never", "T1", "0", "false", "0", "LOG_WARNING", "10"}, + []string{"STANDARD_TRIGGERS", "1", "*min_balance", "2", "false", "0", "b1", "*monetary", "*out", "call", "", "special1", "SHARED_1", "*never", "T1", "0", "false", "0", "LOG_WARNING", "10"}, + []string{"STANDARD_TRIGGERS", "2", "*max_event_counter", "5", "false", "0", "b2", "*monetary", "*out", "call", "FS_USERS", "special1", "SHARED_1", "*never", "T1", "0", "false", "0", "LOG_WARNING", "10"}, } ms := APItoModelActionTrigger(at) var slc [][]string