mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Trim fldPath Increments before retrieving one of its fields
This commit is contained in:
committed by
Dan Christian Bogos
parent
42892eff01
commit
7eeab045a3
@@ -1094,7 +1094,7 @@ func (ec *EventCost) getChargesForPath(fldPath []string, chr *ChargingInterval)
|
||||
if fldPath[1] == utils.Accounting {
|
||||
return ec.getAcountingForPath(fldPath[2:], ec.Accounting[incr.AccountingID])
|
||||
}
|
||||
return incr.FieldAsInterface(fldPath)
|
||||
return incr.FieldAsInterface(fldPath[1:])
|
||||
}
|
||||
|
||||
func (ec *EventCost) getRatingForPath(fldPath []string, rating *RatingUnit) (val any, err error) {
|
||||
|
||||
@@ -3822,6 +3822,11 @@ func TestECAsDataProvider3(t *testing.T) {
|
||||
fields: []string{"Charges[1]", "Increments[0]", "Accounting", "Balance", "Type"},
|
||||
exp: "*monetary",
|
||||
},
|
||||
{
|
||||
name: "IncrementCost",
|
||||
fields: []string{"Charges[0]", "Increments[2]", "Cost"},
|
||||
exp: "0.01",
|
||||
},
|
||||
{
|
||||
name: "DestinationPrefix",
|
||||
fields: []string{"Charges[2]", "Rating", "RatingFilter", "DestinationPrefix"},
|
||||
|
||||
Reference in New Issue
Block a user