fix get all eaction plans keys

This commit is contained in:
Radu Ioan Fericean
2016-08-16 19:30:29 +03:00
parent 58ad3a0cec
commit 1e053d2c8f
5 changed files with 6 additions and 5 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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