loader db updates for rounding stuf movement

This commit is contained in:
Radu Ioan Fericean
2014-05-07 15:31:54 +03:00
parent dc7330b3c9
commit 7a70b50bf4
4 changed files with 12 additions and 9 deletions

View File

@@ -47,8 +47,6 @@ CREATE TABLE `tp_rates` (
`rate_unit` varchar(16) NOT NULL,
`rate_increment` varchar(16) NOT NULL,
`group_interval_start` varchar(16) NOT NULL,
`rounding_method` varchar(255) NOT NULL,
`rounding_decimals` tinyint(4) NOT NULL,
PRIMARY KEY (`tbid`),
UNIQUE KEY `unique_tprate` (`tpid`,`id`,`group_interval_start`),
KEY `tpid` (`tpid`),
@@ -66,6 +64,8 @@ CREATE TABLE `tp_destination_rates` (
`id` varchar(64) NOT NULL,
`destinations_id` varchar(64) NOT NULL,
`rates_id` varchar(64) NOT NULL,
`rounding_method` varchar(255) NOT NULL,
`rounding_decimals` tinyint(4) NOT NULL,
PRIMARY KEY (`tbid`),
KEY `tpid` (`tpid`),
KEY `tpid_drid` (`tpid`,`id`),

View File

@@ -1,3 +1,3 @@
#Tag,DestinationsTag,RatesTag
DR_RETAIL,GERMANY,RT_1CENT
DR_RETAIL,GERMANY_MOBILE,RT_1CENT
DR_RETAIL,GERMANY,RT_1CENT,*up,2
DR_RETAIL,GERMANY_MOBILE,RT_1CENT,*up,2
1 #Tag #Tag,DestinationsTag,RatesTag DestinationsTag RatesTag
2 DR_RETAIL DR_RETAIL,GERMANY,RT_1CENT,*up,2 GERMANY RT_1CENT
3 DR_RETAIL DR_RETAIL,GERMANY_MOBILE,RT_1CENT,*up,2 GERMANY_MOBILE RT_1CENT

View File

@@ -1,2 +1,2 @@
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals
RT_1CENT,0,1,1s,1s,0s,*up,2
RT_1CENT,0,1,1s,1s,0s
1 #Tag #Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals ConnectFee Rate RateUnit RateIncrement GroupIntervalStart RoundingMethod RoundingDecimals
2 RT_1CENT RT_1CENT,0,1,1s,1s,0s 0 1 1s 1s 0s *up 2

View File

@@ -943,8 +943,9 @@ func (self *SQLStorage) GetTpDestinationRates(tpid, tag string) (map[string]*uti
defer rows.Close()
for rows.Next() {
var id int
var tpid, tag, destinations_tag, rate_tag string
if err := rows.Scan(&id, &tpid, &tag, &destinations_tag, &rate_tag); err != nil {
var tpid, tag, destinations_tag, rate_tag, rounding_method string
var rounding_decimals int
if err := rows.Scan(&id, &tpid, &tag, &destinations_tag, &rate_tag, &rounding_method, &rounding_decimals); err != nil {
return nil, err
}
@@ -953,8 +954,10 @@ func (self *SQLStorage) GetTpDestinationRates(tpid, tag string) (map[string]*uti
DestinationRateId: tag,
DestinationRates: []*utils.DestinationRate{
&utils.DestinationRate{
DestinationId: destinations_tag,
RateId: rate_tag,
DestinationId: destinations_tag,
RateId: rate_tag,
RoundingMethod: rounding_method,
RoundingDecimals: rounding_decimals,
},
},
}