action plan create task

This commit is contained in:
Radu Ioan Fericean
2015-12-20 21:55:05 +02:00
parent 45b87e8465
commit e75dd526b2

View File

@@ -216,6 +216,19 @@ func (self *ApierV1) SetAccount(attr utils.AttrSetAccount, reply *string) error
}
ap.AccountIDs[accID] = struct{}{}
schedulerReloadNeeded = true
// create tasks
for _, at := range actionPlan.ActionTimings {
if at.IsASAP() {
t := &Task{
Uuid: utils.GenUUID(),
AccountID: accID,
ActionsID: at.ActionsID,
}
if err = tpr.ratingStorage.PushTask(t); err != nil {
return err
}
}
}
if err := self.RatingDb.SetActionPlan(attr.ActionPlanId, ap); err != nil {
return 0, err
}