From 1e053d2c8f5dfc81be4e2a8ae247b565600c4d58 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Tue, 16 Aug 2016 19:30:29 +0300 Subject: [PATCH] fix get all eaction plans keys --- apier/v1/accounts.go | 2 +- apier/v2/accounts.go | 3 ++- engine/storage_map.go | 2 +- engine/storage_mongo_datadb.go | 2 +- engine/storage_redis.go | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apier/v1/accounts.go b/apier/v1/accounts.go index 5f33c27fe..5715b69fd 100644 --- a/apier/v1/accounts.go +++ b/apier/v1/accounts.go @@ -194,7 +194,7 @@ func (self *ApierV1) SetAccount(attr utils.AttrSetAccount, reply *string) error return 0, err } for actionPlanID, ap := range actionPlansMap { - if actionPlanID[len(utils.ACTION_PLAN_PREFIX):] == attr.ActionPlanId { + if actionPlanID == attr.ActionPlanId { // don't remove it if it's the current one continue } diff --git a/apier/v2/accounts.go b/apier/v2/accounts.go index cdb4fbf5a..168179e8d 100644 --- a/apier/v2/accounts.go +++ b/apier/v2/accounts.go @@ -20,6 +20,7 @@ package v2 import ( "fmt" + "log" "math" "github.com/cgrates/cgrates/engine" @@ -129,7 +130,6 @@ func (self *ApierV2) SetAccount(attr AttrSetAccount, reply *string) error { } } } - for _, actionPlanID := range *attr.ActionPlanIDs { ap, ok := actionPlansMap[actionPlanID] if !ok { @@ -157,6 +157,7 @@ func (self *ApierV2) SetAccount(attr AttrSetAccount, reply *string) error { } } } + log.Print(5) for actionPlanID, ap := range dirtyActionPlans { if err := self.RatingDb.SetActionPlan(actionPlanID, ap, true); err != nil { return 0, err diff --git a/engine/storage_map.go b/engine/storage_map.go index c02dee3e1..4dec98392 100644 --- a/engine/storage_map.go +++ b/engine/storage_map.go @@ -1002,7 +1002,7 @@ func (ms *MapStorage) GetAllActionPlans() (ats map[string]*ActionPlan, err error if err != nil { return nil, err } - ats[key] = ap + ats[key[len(utils.ACTION_PLAN_PREFIX):]] = ap } return diff --git a/engine/storage_mongo_datadb.go b/engine/storage_mongo_datadb.go index 46b8263bf..7d15abd49 100644 --- a/engine/storage_mongo_datadb.go +++ b/engine/storage_mongo_datadb.go @@ -1471,7 +1471,7 @@ func (ms *MongoStorage) GetAllActionPlans() (ats map[string]*ActionPlan, err err if err != nil { return nil, err } - ats[key] = ap + ats[key[len(utils.ACTION_PLAN_PREFIX):]] = ap } return diff --git a/engine/storage_redis.go b/engine/storage_redis.go index 113d75ec0..12a025ba4 100644 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -1053,7 +1053,7 @@ func (rs *RedisStorage) GetAllActionPlans() (ats map[string]*ActionPlan, err err if err != nil { return nil, err } - ats[key] = ap + ats[key[len(utils.ACTION_PLAN_PREFIX):]] = ap } return