From 9285d5ba2eb66957c3d0a2458c7eba2bd53eaa7f Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 28 Jan 2020 08:23:37 +0200 Subject: [PATCH] Updated internal stordb GetCDRsCount --- engine/storage_internal_stordb.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/engine/storage_internal_stordb.go b/engine/storage_internal_stordb.go index c0e17e7c0..dee707dc6 100644 --- a/engine/storage_internal_stordb.go +++ b/engine/storage_internal_stordb.go @@ -1141,6 +1141,9 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C grpMpIDs.AddSlice(grpIDs) } if grpMpIDs.Size() == 0 { + if filter.Count { + return nil, 0, nil + } return nil, 0, utils.ErrNotFound } if cdrMpIDs == nil { @@ -1148,6 +1151,9 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C } else { cdrMpIDs.Intersect(grpMpIDs) if cdrMpIDs.Size() == 0 { + if filter.Count { + return nil, 0, nil + } return nil, 0, utils.ErrNotFound } } @@ -1166,6 +1172,9 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C if cdrMpIDs.Has(id) { cdrMpIDs.Remove(id) if cdrMpIDs.Size() == 0 { + if filter.Count { + return nil, 0, nil + } return nil, 0, utils.ErrNotFound } } @@ -1174,6 +1183,9 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C } if cdrMpIDs.Size() == 0 { + if filter.Count { + return nil, 0, nil + } return nil, 0, utils.ErrNotFound } @@ -1711,7 +1723,6 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C default: return nil, 0, fmt.Errorf("Invalid value : %s", separateVals[0]) } - } return }