From 013ab42cdef9394e7381f111d69d8dada31a1410 Mon Sep 17 00:00:00 2001 From: DanB Date: Tue, 28 Nov 2017 19:29:46 +0100 Subject: [PATCH] Supplier entry filters for same event, integration test --- data/tariffplans/tutorial/Suppliers.csv | 3 ++- engine/suppliers.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/tariffplans/tutorial/Suppliers.csv b/data/tariffplans/tutorial/Suppliers.csv index 1f93be5a2..0ff83c0ff 100644 --- a/data/tariffplans/tutorial/Suppliers.csv +++ b/data/tariffplans/tutorial/Suppliers.csv @@ -1,4 +1,5 @@ #Tenant,ID,FilterIDs,ActivationInterval,Sorting,SortingParams,SupplierID,SupplierFilterIDs,SupplierAccountIDs,SupplierRatingPlanIDs,SupplierResourceIDs,SupplierStatIDs,SupplierWeight,Blocker,Weight cgrates.org,SPP_1,FLTR_ACNT_dan;FLTR_DST_DE,2017-07-29T15:00:00Z,*lowest_cost,,supplier1,FLTR_ACNT_dan,,RPL_1,ResGroup1,Stat1,10,false,10 cgrates.org,SPL_WEIGHT_1,FLTR_DST_DE;FLTR_ACNT_1007,2017-11-27T00:00:00Z,*weight,,supplier1,,,,,,10,false,10 -cgrates.org,SPL_WEIGHT_1,,,,,supplier2,,,,,,20,, +cgrates.org,SPL_WEIGHT_1,FLTR_DST_DE,,,,supplier2,,,,,,20,, +cgrates.org,SPL_WEIGHT_1,FLTR_ACNT_1007,,,,supplier3,FLTR_ACNT_dan,,,,,15,, diff --git a/engine/suppliers.go b/engine/suppliers.go index 03f2eb4e8..2a8032704 100644 --- a/engine/suppliers.go +++ b/engine/suppliers.go @@ -168,6 +168,7 @@ func (spS *SupplierService) matchingSupplierProfilesForEvent(ev *SupplierEvent) defer guardian.Guardian.UnguardIDs(lockIDs...) for lpID := range sPrflIDs { lcrPrfl, err := spS.dm.GetSupplierProfile(ev.Tenant, lpID, false, utils.NonTransactional) + //fmt.Printf("LoadedSupplier: %s\n", utils.ToJSON(lcrPrfl)) if err != nil { if err == utils.ErrNotFound { continue @@ -240,7 +241,7 @@ func (spS *SupplierService) sortedSuppliersForEvent(ev *SupplierEvent) (sortedSu for _, s := range lcrPrfl.Suppliers { if len(s.FilterIDs) != 0 { // filters should be applied, check them here if pass, err := spS.filterS.PassFiltersForEvent(ev.Tenant, - map[string]interface{}{"SupplierID": s.ID}, s.FilterIDs); err != nil { + ev.Event, s.FilterIDs); err != nil { return nil, err } else if !pass { continue