diff --git a/utils/datanode_test.go b/utils/datanode_test.go index c4f5e3250..6c23dc54c 100644 --- a/utils/datanode_test.go +++ b/utils/datanode_test.go @@ -19,7 +19,6 @@ along with this program. If not, see package utils import ( - "fmt" "reflect" "regexp" "strings" @@ -378,13 +377,10 @@ func TestAppend2(t *testing.T) { dn.Type = NMMapType dn.Slice = nil dn.Map = map[string]*DataNode{} - dnExpect := NewDataNode(testPath) if _, err := dn.Append(testPath, val1); err != nil { t.Error(err) } - fmt.Println(ToJSON(dn.Map["0"])) - fmt.Println(ToJSON(dnExpect)) /// dn.Type = NMSliceType diff --git a/utils/eventcharges.go b/utils/eventcharges.go index 0d5c5f481..533665aff 100644 --- a/utils/eventcharges.go +++ b/utils/eventcharges.go @@ -47,6 +47,7 @@ type EventCharges struct { // Merge will merge the event charges into existing func (ec *EventCharges) Merge(eCs ...*EventCharges) { + ec.syncIDs(eCs...) // so we can compare properly for _, nEc := range eCs { if ec.Abstracts != nil { ec.Abstracts = &Decimal{SumBig(ec.Abstracts.Big, nEc.Abstracts.Big)} @@ -63,7 +64,7 @@ func (ec *EventCharges) Merge(eCs ...*EventCharges) { } // SyncIDs will repopulate Accounting, UnitFactors and Rating IDs if they equal the references in ec -func (ec *EventCharges) SyncIDs(eCs ...*EventCharges) { +func (ec *EventCharges) syncIDs(eCs ...*EventCharges) { for _, nEc := range eCs { for _, cIl := range nEc.ChargingIntervals { for _, cIcrm := range cIl.Increments { @@ -120,7 +121,6 @@ func (ec *EventCharges) AppendChargingIntervals(cIls ...*ChargingInterval) { ec.ChargingIntervals = []*ChargingInterval{cIl} continue } - if ec.ChargingIntervals[len(ec.ChargingIntervals)-1].CompressEquals(cIl) { ec.ChargingIntervals[len(ec.ChargingIntervals)-1].CompressFactor += 1 continue