trim spaces for balance dest ids

This commit is contained in:
Radu Ioan Fericean
2015-09-20 10:09:55 +03:00
parent d43cf8c927
commit ac7eb6fbaf
2 changed files with 3 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
#! /usr/bin/env sh
echo "Installing CGRateS..."
echo "Building CGRateS..."
go install github.com/cgrates/cgrates/cmd/cgr-engine
cr=$?

View File

@@ -188,13 +188,13 @@ func (ub *Account) getBalancesForPrefix(prefix, category string, balances Balanc
}
b.account = ub
if b.DestinationIds != "" && b.DestinationIds != utils.ANY {
balDestIds := strings.Split(b.DestinationIds, utils.INFIELD_SEP)
for _, p := range utils.SplitPrefix(prefix, MIN_PREFIX_MATCH) {
if x, err := cache2go.Get(utils.DESTINATION_PREFIX + p); err == nil {
destIds := x.(map[interface{}]struct{})
for dId, _ := range destIds {
balDestIds := strings.Split(b.DestinationIds, utils.INFIELD_SEP)
for _, balDestID := range balDestIds {
if dId == balDestID {
if dId == strings.TrimSpace(balDestID) {
b.precision = len(p)
usefulBalances = append(usefulBalances, b)
break