mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Cleaning up weight from mysql and sample data files
This commit is contained in:
@@ -55,7 +55,7 @@ func (self *ApierV1) SetTPActions(attrs utils.TPActions, reply *string) error {
|
||||
Balance: &engine.Balance{
|
||||
Value: act.Units,
|
||||
DestinationId: act.DestinationId,
|
||||
RateSubject: act.RateSubject,
|
||||
RateSubject: act.RatingSubject,
|
||||
Weight: act.BalanceWeight,
|
||||
},
|
||||
Weight: act.Weight,
|
||||
|
||||
@@ -45,14 +45,14 @@ type CGRConfig struct {
|
||||
DataDBName string // The name of the database to connect to.
|
||||
DataDBUser string // The user to sign in as.
|
||||
DataDBPass string // The user's password.
|
||||
DataDBEncoding string // The encoding used to store objects in string keys
|
||||
DataDBEncoding string // The encoding used to store objects in string keys
|
||||
StorDBType string // Should reflect the database type used to store logs
|
||||
StorDBHost string // The host to connect to. Values that start with / are for UNIX domain sockets.
|
||||
StorDBPort string // The port to bind to.
|
||||
StorDBName string // The name of the database to connect to.
|
||||
StorDBUser string // The user to sign in as.
|
||||
StorDBPass string // The user's password.
|
||||
DBDataEncoding string // The encoding used to store object data in strings: <msgpack|json>
|
||||
DBDataEncoding string // The encoding used to store object data in strings: <msgpack|json>
|
||||
RPCEncoding string // RPC encoding used on APIs: <gob|json>.
|
||||
DefaultReqType string // Use this request type if not defined on top
|
||||
DefaultTOR string // set default type of record
|
||||
|
||||
@@ -46,7 +46,6 @@ CREATE TABLE `tp_rates` (
|
||||
`group_interval_start` int(11) NOT NULL,
|
||||
`rounding_method` varchar(255) NOT NULL,
|
||||
`rounding_decimals` tinyint(4) NOT NULL,
|
||||
`weight` decimal(5,2) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_tprate` (`tpid`,`tag`,`group_interval_start`),
|
||||
KEY `tpid` (`tpid`),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals,Weight
|
||||
LANDLINE_PEAK,0.02,0.02,60s,60s,0s,*up,4,10
|
||||
LANDLINE_PEAK,0.02,0.01,1s,1s,60s,*up,4,10
|
||||
MOBILE_PEAK,0.02,0.14,60s,60s,0s,*up,4,10
|
||||
LANDLINE_OFFPEAK,1,0,60s,60s,0s,*up,4,10
|
||||
MOBILE_OFFPEAK,0.02,0.1,60s,60s,0,*up,4,10
|
||||
RT_FS_USERS,0,0,60s,60s,0s,*up,0,10
|
||||
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals
|
||||
LANDLINE_PEAK,0.02,0.02,60s,60s,0s,*up,4
|
||||
LANDLINE_PEAK,0.02,0.01,1s,1s,60s,*up,4
|
||||
MOBILE_PEAK,0.02,0.14,60s,60s,0s,*up,4
|
||||
LANDLINE_OFFPEAK,1,0,60s,60s,0s,*up,4
|
||||
MOBILE_OFFPEAK,0.02,0.1,60s,60s,0,*up,4
|
||||
RT_FS_USERS,0,0,60s,60s,0s,*up,0
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals,Weight
|
||||
RT_FS_USERS,0,0,60s,60s,0s,*up,0,10
|
||||
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals
|
||||
RT_FS_USERS,0,0,60s,60s,0s,*up,0
|
||||
|
||||
|
@@ -196,14 +196,14 @@ func (self *SQLStorage) SetTPRates(tpid string, rts map[string][]*LoadRate) erro
|
||||
if len(rts) == 0 {
|
||||
return nil //Nothing to set
|
||||
}
|
||||
qry := fmt.Sprintf("INSERT INTO %s (tpid, tag, connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals, weight) VALUES ", utils.TBL_TP_RATES)
|
||||
qry := fmt.Sprintf("INSERT INTO %s (tpid, tag, connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals) VALUES ", utils.TBL_TP_RATES)
|
||||
i := 0
|
||||
for rtId, rtRows := range rts {
|
||||
for _, rt := range rtRows {
|
||||
if i != 0 { //Consecutive values after the first will be prefixed with "," as separator
|
||||
qry += ","
|
||||
}
|
||||
qry += fmt.Sprintf("('%s', '%s', %f, %f, %d, %d,%d,'%s', %d, %f)",
|
||||
qry += fmt.Sprintf("('%s', '%s', %f, %f, %d, %d,%d,'%s', %d)",
|
||||
tpid, rtId, rt.ConnectFee, rt.Price, rt.RateUnit, rt.RateIncrement, rt.GroupIntervalStart,
|
||||
rt.RoundingMethod, rt.RoundingDecimals)
|
||||
i++
|
||||
@@ -216,7 +216,7 @@ func (self *SQLStorage) SetTPRates(tpid string, rts map[string][]*LoadRate) erro
|
||||
}
|
||||
|
||||
func (self *SQLStorage) GetTPRate(tpid, rtId string) (*utils.TPRate, error) {
|
||||
rows, err := self.Db.Query(fmt.Sprintf("SELECT connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals, weight FROM %s WHERE tpid='%s' AND tag='%s'", utils.TBL_TP_RATES, tpid, rtId))
|
||||
rows, err := self.Db.Query(fmt.Sprintf("SELECT connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals FROM %s WHERE tpid='%s' AND tag='%s'", utils.TBL_TP_RATES, tpid, rtId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -225,11 +225,11 @@ func (self *SQLStorage) GetTPRate(tpid, rtId string) (*utils.TPRate, error) {
|
||||
i := 0
|
||||
for rows.Next() {
|
||||
i++ //Keep here a reference so we know we got at least one prefix
|
||||
var connectFee, rate, weight float64
|
||||
var connectFee, rate float64
|
||||
var roundingDecimals int
|
||||
var rateUnit, rateIncrement, groupIntervalStart time.Duration
|
||||
var roundingMethod string
|
||||
err = rows.Scan(&connectFee, &rate, &rateUnit, &rateIncrement, &groupIntervalStart, &roundingMethod, &roundingDecimals, &weight)
|
||||
err = rows.Scan(&connectFee, &rate, &rateUnit, &rateIncrement, &groupIntervalStart, &roundingMethod, &roundingDecimals)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ type Action struct {
|
||||
Units float64 // Number of units to add/deduct
|
||||
ExpiryTime string // Time when the units will expire
|
||||
DestinationId string // Destination profile id
|
||||
RateSubject string // Reference a rate subject defined in RatingProfiles
|
||||
RatingSubject string // Reference a rate subject defined in RatingProfiles
|
||||
BalanceWeight float64 // Balance weight
|
||||
ExtraParameters string
|
||||
Weight float64 // Action's weight
|
||||
|
||||
@@ -55,6 +55,6 @@ const (
|
||||
ROUNDING_MIDDLE = "*middle"
|
||||
ROUNDING_DOWN = "*down"
|
||||
COMMENT_CHAR = '#'
|
||||
JSON = "json"
|
||||
MSGPACK = "msgpack"
|
||||
JSON = "json"
|
||||
MSGPACK = "msgpack"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user