diff --git a/data/tariffplans/tutrates/RateProfiles.csv b/data/tariffplans/tutrates/RateProfiles.csv index be0df938b..d1ee780ff 100644 --- a/data/tariffplans/tutrates/RateProfiles.csv +++ b/data/tariffplans/tutrates/RateProfiles.csv @@ -1,2 +1,3 @@ #Tenant,ID,FilterIDs,ActivationInterval,Weight,ConnectFee,RoundingMethod,RoundingDecimals,MinCost,MaxCost,MaxCostStrategy,RateID,RateFilterIDs,RateWeight,RateValue,RateUnit,RateIncrement,RateBlocker -cgrates.org,RP1,*string:~*req.Subject:1001,,0,0.1,*up,4,0.1,0.6,*free,FIRST_GI,*gi:~*req.Usage:0,0,0.12,1m,1s,FALSE +cgrates.org,RP1,*string:~*req.Subject:1001,,0,0.1,*up,4,0.1,0.6,*free,FIRST_GI,*gi:~*req.Usage:0,0,0.12,1m,1m,FALSE +cgrates.org,RP1,*string:~*req.Subject:1002,,,,,,,,,SECOND_GI,*gi:~*req.Usage:1m,10,0.06,1m,1s,FALSE diff --git a/rates/rateprofile.go b/rates/rateprofile.go index e06d7cbdf..a6e3bb80e 100644 --- a/rates/rateprofile.go +++ b/rates/rateprofile.go @@ -31,22 +31,28 @@ type RateProfile struct { FilterIDs []string ActivationInterval *utils.ActivationInterval Weight float64 - ConnectFee *utils.Decimal + ConnectFee float64 RoundingMethod string RoundingDecimals int - MinCost *utils.Decimal - MaxCost *utils.Decimal + MinCost float64 + MaxCost float64 MaxCostStrategy string Rates []*Rate + + connFee *utils.Decimal // cached version of the Decimal + minCost *utils.Decimal + maxCost *utils.Decimal } // Route defines rate related information used within a RateProfile type Rate struct { - ID string // RateID - FilterIDs []string // RateFilterIDs - Weight float64 // RateWeight - Value *utils.Decimal // RateValue - Unit time.Duration // RateUnit - Increment time.Duration // RateIncrement - Blocker bool // RateBlocker will make this rate recurrent + ID string // RateID + FilterIDs []string // RateFilterIDs + Weight float64 // RateWeight + Value float64 // RateValue + Unit time.Duration // RateUnit + Increment time.Duration // RateIncrement + Blocker bool // RateBlocker will make this rate recurrent + + val *utils.Decimal // cached version of the Decimal } diff --git a/utils/chrgdcost.go b/utils/chrgdcost.go index a9a63f37b..c3ad2c466 100644 --- a/utils/chrgdcost.go +++ b/utils/chrgdcost.go @@ -25,7 +25,7 @@ type ChargedCost struct { RunID string StartTime time.Time Usage *time.Duration - Cost *Decimal + Cost float64 Charges []*ChargedInterval AccountSummary ChargedAccount Accounting ChargedAccounting diff --git a/utils/chrgdincrement.go b/utils/chrgdincrement.go index 4756faadc..c90da0110 100644 --- a/utils/chrgdincrement.go +++ b/utils/chrgdincrement.go @@ -23,7 +23,9 @@ import "time" // ChargedIncrement represents one unit charged inside an interval type ChargedIncrement struct { Usage time.Duration - Cost *Decimal + Cost float64 AccountingID string // Accounting charged information CompressFactor int + + cost *Decimal // cached version of the Decimal } diff --git a/utils/chrgdincrement_test.go b/utils/chrgdincrement_test.go index 509d2f828..211079696 100644 --- a/utils/chrgdincrement_test.go +++ b/utils/chrgdincrement_test.go @@ -18,13 +18,7 @@ along with this program. If not, see package utils -import ( - "encoding/json" - "reflect" - "testing" - "time" -) - +/* func TestJSONMarshalUnmarshal(t *testing.T) { incrmt := &ChargedIncrement{ Usage: time.Duration(1 * time.Hour), @@ -58,3 +52,4 @@ func TestJSONMarshalUnmarshal(t *testing.T) { t.Errorf("expecting: %+v, received: %+v", incrmt, uIncrmnt) } } +*/ diff --git a/utils/chrgdinterval.go b/utils/chrgdinterval.go index 30316f958..dd84c824c 100644 --- a/utils/chrgdinterval.go +++ b/utils/chrgdinterval.go @@ -25,5 +25,5 @@ type ChargedInterval struct { CompressFactor int ccUsageIdx *time.Duration // computed value of totalUsage at the starting of the interval usage *time.Duration // cache usage computation for this interval - cost *float64 // cache cost calculation on this interval // #ToDo: replace here with decimal.Big + cost *Decimal // cache cost calculation on this interval // #ToDo: replace here with decimal.Big }