From f9a499752eae31f403e48d658856d3f5a69e79d2 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Wed, 2 Mar 2016 16:09:45 +0200 Subject: [PATCH] fix RemActionTiming API --- apier/v1/accounts.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apier/v1/accounts.go b/apier/v1/accounts.go index 21131ea16..200bf18a3 100644 --- a/apier/v1/accounts.go +++ b/apier/v1/accounts.go @@ -93,8 +93,9 @@ func (self *ApierV1) RemActionTiming(attrs AttrRemActionTiming, reply *string) e return 0, utils.ErrNotFound } - if attrs.ActionPlanId != "" { // delete the entire action plan - ap.ActionTimings = nil // will delete the action plan + if attrs.Tenant != "" && attrs.Account != "" { + accID := utils.AccountKey(attrs.Tenant, attrs.Account) + delete(ap.AccountIDs, accID) return 0, self.RatingDb.SetActionPlan(ap.Id, ap, true) } @@ -109,9 +110,8 @@ func (self *ApierV1) RemActionTiming(attrs AttrRemActionTiming, reply *string) e return 0, self.RatingDb.SetActionPlan(ap.Id, ap, true) } - if attrs.Tenant != "" && attrs.Account != "" { - accID := utils.AccountKey(attrs.Tenant, attrs.Account) - delete(ap.AccountIDs, accID) + if attrs.ActionPlanId != "" { // delete the entire action plan + ap.ActionTimings = nil // will delete the action plan return 0, self.RatingDb.SetActionPlan(ap.Id, ap, true) }