mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-19 22:28:45 +05:00
EventCost compressing correcting RatingID within Accounting
This commit is contained in:
@@ -459,6 +459,9 @@ func (ec *EventCost) SyncKeys(refEC *EventCost) {
|
||||
// sync Accounting
|
||||
sncedAcntIDs := make(map[string]string)
|
||||
for key, acnt := range ec.Accounting {
|
||||
if rtRefKey, has := sncedRatingIDs[acnt.RatingID]; has {
|
||||
acnt.RatingID = rtRefKey
|
||||
}
|
||||
for refKey, refAcnt := range refEC.Accounting {
|
||||
if acnt.Equals(refAcnt) {
|
||||
delete(ec.Accounting, key)
|
||||
|
||||
@@ -2033,6 +2033,7 @@ func TestECAppendCIlFromEC(t *testing.T) {
|
||||
|
||||
func TestECSyncKeys(t *testing.T) {
|
||||
ec := testEC.Clone()
|
||||
ec.Accounting["a012888"].RatingID = "c1a5ab9"
|
||||
|
||||
refEC := &EventCost{
|
||||
Rating: Rating{
|
||||
@@ -2050,6 +2051,7 @@ func TestECSyncKeys(t *testing.T) {
|
||||
AccountID: "cgrates.org:dan",
|
||||
BalanceUUID: "8c54a9e9-d610-4c82-bcb5-a315b9a65010",
|
||||
Units: 0.01,
|
||||
RatingID: "21a5ab9",
|
||||
},
|
||||
"288bfa6": &BalanceCharge{
|
||||
AccountID: "cgrates.org:dan",
|
||||
@@ -2204,6 +2206,7 @@ func TestECSyncKeys(t *testing.T) {
|
||||
AccountID: "cgrates.org:dan",
|
||||
BalanceUUID: "8c54a9e9-d610-4c82-bcb5-a315b9a65010",
|
||||
Units: 0.01,
|
||||
RatingID: "21a5ab9",
|
||||
},
|
||||
"288bfa6": &BalanceCharge{
|
||||
AccountID: "cgrates.org:dan",
|
||||
|
||||
Reference in New Issue
Block a user