nu more empty balance map checking

This commit is contained in:
Radu Ioan Fericean
2014-10-07 10:16:05 +03:00
parent bafb0b0eb8
commit 578453c766
2 changed files with 9 additions and 7 deletions

View File

@@ -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

View File

@@ -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"