This commit is contained in:
TeoV
2018-10-29 07:30:54 -04:00
committed by Dan Christian Bogos
parent 7ae8ae299b
commit 08e793487a
3 changed files with 6 additions and 6 deletions

View File

@@ -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
}

View File

@@ -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)
}
}

View File

@@ -61,7 +61,7 @@ func (self *CmdGetMaxUsage) PostprocessRpcParams() error {
}
func (self *CmdGetMaxUsage) RpcResult() interface{} {
var f float64
var f int64
return &f
}