mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Rename Factor field to Factors in BalanceSummaries
This commit is contained in:
committed by
Dan Christian Bogos
parent
ea9b6ae83d
commit
45066b2d2f
@@ -1263,7 +1263,7 @@ func resetAccountCDR(ub *Account, action *Action, acts Actions, fltrS *FilterS,
|
||||
Value: &utils.ValueFormula{Static: bsum.Value},
|
||||
Weight: &bsum.Weight,
|
||||
Disabled: &bsum.Disabled,
|
||||
Factor: &bsum.Factor,
|
||||
Factor: &bsum.Factors,
|
||||
},
|
||||
}, fltrS); err != nil {
|
||||
utils.Logger.Warning(fmt.Sprintf("<%s> Error %s setting balance %s for account: %s", utils.Actions, err, bsum.UUID, account))
|
||||
|
||||
@@ -688,7 +688,7 @@ func (b *Balance) AsBalanceSummary(typ string) *BalanceSummary {
|
||||
Value: b.Value,
|
||||
Weight: b.Weight,
|
||||
Disabled: b.Disabled,
|
||||
Factor: b.Factor,
|
||||
Factors: b.Factor,
|
||||
}
|
||||
if bd.ID == "" {
|
||||
bd.ID = b.Uuid
|
||||
@@ -801,7 +801,7 @@ type BalanceSummary struct {
|
||||
Value float64
|
||||
Weight float64 `json:",omitempty"`
|
||||
Disabled bool
|
||||
Factor ValueFactor `json:",omitempty"`
|
||||
Factors ValueFactor `json:",omitempty"`
|
||||
}
|
||||
|
||||
// BalanceSummaries is a list of BalanceSummaries
|
||||
@@ -840,11 +840,11 @@ func (bl *BalanceSummary) FieldAsInterface(fldPath []string) (val any, err error
|
||||
return bl.Disabled, nil
|
||||
case utils.Initial:
|
||||
return bl.Initial, nil
|
||||
case utils.Factor:
|
||||
case utils.Factors:
|
||||
if len(fldPath) == 1 {
|
||||
return bl.Factor, nil
|
||||
return bl.Factors, nil
|
||||
}
|
||||
return bl.Factor.FieldAsInterface(fldPath[1:])
|
||||
return bl.Factors.FieldAsInterface(fldPath[1:])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ var testEC = &EventCost{
|
||||
Initial: 60,
|
||||
Weight: 20,
|
||||
Disabled: false,
|
||||
Factor: ValueFactor{
|
||||
Factors: ValueFactor{
|
||||
"factor2": 2,
|
||||
"factor3": 3,
|
||||
},
|
||||
@@ -125,7 +125,7 @@ var testEC = &EventCost{
|
||||
Weight: 0,
|
||||
Initial: 60,
|
||||
Disabled: false,
|
||||
Factor: ValueFactor{
|
||||
Factors: ValueFactor{
|
||||
"factor2": 2,
|
||||
},
|
||||
},
|
||||
@@ -137,7 +137,7 @@ var testEC = &EventCost{
|
||||
Weight: 10,
|
||||
Initial: 250,
|
||||
Disabled: true,
|
||||
Factor: ValueFactor{
|
||||
Factors: ValueFactor{
|
||||
"factor4": 4,
|
||||
"factor5": 5,
|
||||
},
|
||||
@@ -2542,7 +2542,7 @@ func TestECSyncKeys(t *testing.T) {
|
||||
Initial: 60,
|
||||
Weight: 20,
|
||||
Disabled: false,
|
||||
Factor: ValueFactor{
|
||||
Factors: ValueFactor{
|
||||
"factor2": 2,
|
||||
"factor3": 3,
|
||||
},
|
||||
@@ -2555,7 +2555,7 @@ func TestECSyncKeys(t *testing.T) {
|
||||
Initial: 60,
|
||||
Weight: 0,
|
||||
Disabled: false,
|
||||
Factor: ValueFactor{
|
||||
Factors: ValueFactor{
|
||||
"factor2": 2,
|
||||
},
|
||||
},
|
||||
@@ -2567,7 +2567,7 @@ func TestECSyncKeys(t *testing.T) {
|
||||
Initial: 250,
|
||||
Weight: 10,
|
||||
Disabled: true,
|
||||
Factor: ValueFactor{
|
||||
Factors: ValueFactor{
|
||||
"factor4": 4,
|
||||
"factor5": 5,
|
||||
},
|
||||
@@ -3901,12 +3901,12 @@ func TestECAsDataProvider3(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "Factor map",
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Factor"},
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Factors"},
|
||||
exp: `{"factor4":4,"factor5":5}`,
|
||||
},
|
||||
{
|
||||
name: "Factor value",
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Factor", "factor4"},
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Factors", "factor4"},
|
||||
exp: "4",
|
||||
},
|
||||
{
|
||||
@@ -4081,12 +4081,12 @@ func TestECAsDataProvider3(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "Factor map through ExtraCharge",
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Factor"},
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Factors"},
|
||||
exp: `{"factor2":2,"factor3":3}`,
|
||||
},
|
||||
{
|
||||
name: "Factor value through ExtraCharge",
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Factor", "factor3"},
|
||||
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Factors", "factor3"},
|
||||
exp: "3",
|
||||
},
|
||||
{
|
||||
|
||||
@@ -431,7 +431,7 @@ cgrates.org,call,1001,2014-01-14T00:00:00Z,RP_ANY,`,
|
||||
if monetaryBalanceValue != 4. {
|
||||
t.Errorf("unexpected balance value: expected %v, received %v", 4., monetaryBalanceValue)
|
||||
}
|
||||
smsBalanceFactor, err := cdrs[0].CostDetails.FieldAsInterface([]string{"AccountSummary", "BalanceSummaries[0]", "Factor", "smsFactor"})
|
||||
smsBalanceFactor, err := cdrs[0].CostDetails.FieldAsInterface([]string{"AccountSummary", "BalanceSummaries[0]", "Factors", "smsFactor"})
|
||||
if err != nil {
|
||||
t.Fatalf("could not retrieve *sms balance factor: %v", err)
|
||||
}
|
||||
|
||||
@@ -469,6 +469,7 @@ func testSesPauseItInitPause(t *testing.T) {
|
||||
Type: "*monetary",
|
||||
Initial: 10,
|
||||
Value: 9.8,
|
||||
Weight: 10,
|
||||
}},
|
||||
},
|
||||
Rating: engine.Rating{
|
||||
@@ -664,6 +665,7 @@ func testSesPauseItInitUpdatePause(t *testing.T) {
|
||||
Type: "*monetary",
|
||||
Initial: 9.8,
|
||||
Value: 9.6,
|
||||
Weight: 10,
|
||||
}},
|
||||
},
|
||||
Rating: engine.Rating{
|
||||
@@ -861,6 +863,7 @@ func testSesPauseItUpdatePause(t *testing.T) {
|
||||
Type: "*monetary",
|
||||
Initial: 9.6,
|
||||
Value: 9.,
|
||||
Weight: 10,
|
||||
}},
|
||||
},
|
||||
Rating: engine.Rating{
|
||||
|
||||
@@ -877,6 +877,7 @@ const (
|
||||
UnitFactors = "UnitFactors"
|
||||
CostIncrements = "CostIncrements"
|
||||
Factor = "Factor"
|
||||
Factors = "Factors"
|
||||
Method = "Method"
|
||||
Static = "Static"
|
||||
Params = "Params"
|
||||
|
||||
Reference in New Issue
Block a user