mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 16:48:45 +05:00
nu more empty balance map checking
This commit is contained in:
@@ -625,12 +625,17 @@ func (rs *RedisStorage) GetAccount(key string) (ub *Account, err error) {
|
||||
|
||||
func (rs *RedisStorage) SetAccount(ub *Account) (err error) {
|
||||
// never override existing account with an empty one
|
||||
if len(ub.BalanceMap) == 0 {
|
||||
// UPDATE: if all balances expired and were clean it makes
|
||||
// sense to write empty balance map
|
||||
/*if len(ub.BalanceMap) == 0 {
|
||||
if ac, err := rs.GetAccount(ub.Id); err == nil {
|
||||
ac.ActionTriggers = ub.ActionTriggers
|
||||
ac.UnitCounters = ub.UnitCounters
|
||||
ac.AllowNegative = ub.AllowNegative
|
||||
ac.Disabled = ub.Disabled
|
||||
ub = ac
|
||||
}
|
||||
}
|
||||
}*/
|
||||
result, err := rs.ms.Marshal(ub)
|
||||
err = rs.db.Set(ACCOUNT_PREFIX+ub.Id, result)
|
||||
return
|
||||
|
||||
@@ -19,9 +19,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
package general_tests
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
)
|
||||
|
||||
var ratingDbAcntActs engine.RatingStorage
|
||||
@@ -69,9 +70,6 @@ ENABLE_ACNT,*enable_account,,,,,,,,,,,10`
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//ToDo
|
||||
// This test fails due to Disabled which is ignored on SetAccount with partial content. SetAccount should only be called with account when no previous one set in dataDb.
|
||||
func TestAcntActsDisableAcnt(t *testing.T) {
|
||||
acnt1Tag := "*out:cgrates.org:1"
|
||||
at := &engine.ActionTiming{
|
||||
@@ -88,7 +86,6 @@ func TestAcntActsDisableAcnt(t *testing.T) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", expectAcnt, acnt)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func TestAcntActsEnableAcnt(t *testing.T) {
|
||||
acnt1Tag := "*out:cgrates.org:1"
|
||||
|
||||
Reference in New Issue
Block a user