From 26c6c228323a2720094351e54fe95b0172c4f5c0 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Sun, 7 Dec 2014 13:39:52 +0200 Subject: [PATCH] match empty filters --- engine/balances.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/balances.go b/engine/balances.go index 83bfabd01..e56dee59d 100644 --- a/engine/balances.go +++ b/engine/balances.go @@ -68,12 +68,12 @@ func (b *Balance) MatchFilter(o *Balance) bool { if o.DestinationId == "" { o.DestinationId = utils.ANY } - return b.ExpirationDate.Equal(o.ExpirationDate) && - b.Weight == o.Weight && - b.DestinationId == o.DestinationId && - b.RatingSubject == o.RatingSubject && - b.Category == o.Category && - b.SharedGroup == o.SharedGroup + return (o.ExpirationDate.IsZero() || b.ExpirationDate.Equal(o.ExpirationDate)) && + (o.Weight == 0 || b.Weight == o.Weight) && + (o.DestinationId == "" || b.DestinationId == o.DestinationId) && + (o.RatingSubject == "" || b.RatingSubject == o.RatingSubject) && + (o.Category == "" || b.Category == o.Category) && + (o.SharedGroup == "" || b.SharedGroup == o.SharedGroup) } // the default balance has no destinationid, Expirationdate or ratesubject