mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fixes #1269
This commit is contained in:
committed by
Dan Christian Bogos
parent
7ae8ae299b
commit
08e793487a
@@ -27,7 +27,7 @@ import (
|
||||
)
|
||||
|
||||
// Returns MaxUsage (for calls in seconds), -1 for no limit
|
||||
func (self *ApierV1) GetMaxUsage(usageRecord engine.UsageRecord, maxUsage *float64) error {
|
||||
func (self *ApierV1) GetMaxUsage(usageRecord engine.UsageRecord, maxUsage *int64) error {
|
||||
err := engine.LoadUserProfile(&usageRecord, "ExtraFields")
|
||||
if err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
@@ -63,9 +63,9 @@ func (self *ApierV1) GetMaxUsage(usageRecord engine.UsageRecord, maxUsage *float
|
||||
return err
|
||||
}
|
||||
if maxDur == time.Duration(-1) {
|
||||
*maxUsage = -1.0
|
||||
*maxUsage = -1
|
||||
return nil
|
||||
}
|
||||
*maxUsage = maxDur.Seconds()
|
||||
*maxUsage = maxDur.Nanoseconds()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -127,11 +127,11 @@ func TestSMGV1AccountsBefore(t *testing.T) {
|
||||
func TestSMGV1GetMaxUsage(t *testing.T) {
|
||||
setupReq := map[string]interface{}{utils.RequestType: utils.META_PREPAID, utils.Tenant: "cgrates.org",
|
||||
utils.Account: "1003", utils.Destination: "1002", utils.SetupTime: "2015-11-10T15:20:00Z"}
|
||||
var maxTime float64
|
||||
var maxTime int64
|
||||
if err := smgV1Rpc.Call("SMGenericV1.GetMaxUsage", setupReq, &maxTime); err != nil {
|
||||
t.Error(err)
|
||||
} else if maxTime != 2700 {
|
||||
t.Errorf("Calling ApierV1.GetMaxUsage got maxTime: %f", maxTime)
|
||||
t.Errorf("Calling ApierV1.GetMaxUsage got maxTime: %v", maxTime)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func (self *CmdGetMaxUsage) PostprocessRpcParams() error {
|
||||
}
|
||||
|
||||
func (self *CmdGetMaxUsage) RpcResult() interface{} {
|
||||
var f float64
|
||||
var f int64
|
||||
return &f
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user