diff --git a/engine/attributes.go b/engine/attributes.go index 140644b46..f6822171d 100644 --- a/engine/attributes.go +++ b/engine/attributes.go @@ -73,7 +73,6 @@ func (alS *AttributeService) matchingAttributeProfilesForEvent(ev *utils.CGREven lockIDs := utils.PrefixSliceItems(aPrflIDs.Slice(), utils.AttributeFilterIndexes) guardian.Guardian.GuardIDs(config.CgrConfig().LockingTimeout, lockIDs...) defer guardian.Guardian.UnguardIDs(lockIDs...) - //utils.Logger.Debug(fmt.Sprintf("ID %+v", aPrflIDs)) for apID := range aPrflIDs { aPrfl, err := alS.dm.GetAttributeProfile(ev.Tenant, apID, false, utils.NonTransactional) if err != nil { @@ -106,7 +105,6 @@ func (alS *AttributeService) matchingAttributeProfilesForEvent(ev *utils.CGREven i++ } aPrfls.Sort() - utils.Logger.Debug(fmt.Sprintf("aPrfls %+v", utils.ToJSON(aPrfls))) return } diff --git a/engine/datamanager.go b/engine/datamanager.go index 3b7649983..d299006f0 100644 --- a/engine/datamanager.go +++ b/engine/datamanager.go @@ -1165,8 +1165,8 @@ func (dm *DataManager) GetAttributeProfile(tenant, id string, skipCache bool, tr } return nil, err } + alsPrf.attributes = make(map[string]map[interface{}]*Attribute) for _, attr := range alsPrf.Attributes { - alsPrf.attributes = make(map[string]map[interface{}]*Attribute) alsPrf.attributes[attr.FieldName] = make(map[interface{}]*Attribute) alsPrf.attributes[attr.FieldName][attr.Initial] = &Attribute{ FieldName: attr.FieldName, diff --git a/engine/loader_it_test.go b/engine/loader_it_test.go index fbd577dfe..c0963ce35 100755 --- a/engine/loader_it_test.go +++ b/engine/loader_it_test.go @@ -477,12 +477,12 @@ func TestLoaderITWriteToDatabase(t *testing.T) { } } - for tenatid, th := range loader.attributeProfiles { + for tenatid, attrPrf := range loader.attributeProfiles { rcv, err := loader.dm.GetAttributeProfile(tenatid.Tenant, tenatid.ID, true, utils.NonTransactional) if err != nil { - t.Errorf("Failed GetAttributeProfile, tenant: %s, id: %s, error: %s ", th.Tenant, th.ID, err.Error()) + t.Errorf("Failed GetAttributeProfile, tenant: %s, id: %s, error: %s ", attrPrf.Tenant, attrPrf.ID, err.Error()) } - sts, err := APItoAttributeProfile(th, "UTC") + sts, err := APItoAttributeProfile(attrPrf, "UTC") if err != nil { t.Error(err) } diff --git a/engine/model_helpers.go b/engine/model_helpers.go index 034dd4288..5766868d3 100755 --- a/engine/model_helpers.go +++ b/engine/model_helpers.go @@ -2785,6 +2785,7 @@ func APItoAttributeProfile(tpTH *utils.TPAttributeProfile, timezone string) (th for _, context := range tpTH.Contexts { th.Contexts = append(th.Contexts, context) } + th.attributes = make(map[string]map[interface{}]*Attribute) for _, reqAttr := range tpTH.Attributes { th.Attributes = append(th.Attributes, &Attribute{ Append: reqAttr.Append, @@ -2792,7 +2793,6 @@ func APItoAttributeProfile(tpTH *utils.TPAttributeProfile, timezone string) (th Initial: reqAttr.Initial, Substitute: reqAttr.Substitute, }) - th.attributes = make(map[string]map[interface{}]*Attribute) th.attributes[reqAttr.FieldName] = make(map[interface{}]*Attribute) th.attributes[reqAttr.FieldName][reqAttr.Initial] = &Attribute{ FieldName: reqAttr.FieldName,