mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 14:48:43 +05:00
Update AttributeProfile with new changes
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user