From 45f8243541d14e5aef6e618466b2a6a0710bf317 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Fri, 10 Apr 2015 09:49:49 +0300 Subject: [PATCH] unig time.Duration in LcrSupplierCost --- engine/calldesc.go | 4 ++-- engine/lcr.go | 4 ++-- engine/lcr_test.go | 4 ++-- engine/responder_test.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/calldesc.go b/engine/calldesc.go index 9de2d74b7..a30e17de5 100644 --- a/engine/calldesc.go +++ b/engine/calldesc.go @@ -717,7 +717,7 @@ func (cd *CallDescriptor) GetLCR(stats StatsInterface) (*LCRCost, error) { lcrCost.SupplierCosts = append(lcrCost.SupplierCosts, &LCRSupplierCost{ Supplier: supplier, Cost: cc.Cost, - Duration: cc.GetDuration().String(), + Duration: cc.GetDuration(), }) } } @@ -798,7 +798,7 @@ func (cd *CallDescriptor) GetLCR(stats StatsInterface) (*LCRCost, error) { lcrCost.SupplierCosts = append(lcrCost.SupplierCosts, &LCRSupplierCost{ Supplier: supplier, Cost: cc.Cost, - Duration: cc.GetDuration().String(), + Duration: cc.GetDuration(), QOS: map[string]float64{ "ASR": asr, "ACD": acd, diff --git a/engine/lcr.go b/engine/lcr.go index 5e916391b..672a223bf 100644 --- a/engine/lcr.go +++ b/engine/lcr.go @@ -58,14 +58,14 @@ type LCREntry struct { } type LCRCost struct { - SupplierCosts []*LCRSupplierCost Entry *LCREntry + SupplierCosts []*LCRSupplierCost } type LCRSupplierCost struct { Supplier string Cost float64 - Duration string + Duration time.Duration Error error QOS map[string]float64 qosSortParams []string diff --git a/engine/lcr_test.go b/engine/lcr_test.go index 1360079e7..e8c9d2c0e 100644 --- a/engine/lcr_test.go +++ b/engine/lcr_test.go @@ -94,7 +94,7 @@ func TestLcrGetQosLimitsAll(t *testing.T) { } minAsr, maxAsr, minAcd, maxAcd := le.GetQOSLimits() if minAsr != 1.2 || maxAsr != 2.3 || - minAcd != time.Duration(45)*time.Second || maxAcd != time.Duration(67)*time.Minute { + minAcd != 45*time.Second || maxAcd != 67*time.Minute { t.Error("Wrong qos limits parsed: ", minAsr, maxAsr, minAcd, maxAcd) } } @@ -105,7 +105,7 @@ func TestLcrGetQosLimitsSome(t *testing.T) { } minAsr, maxAsr, minAcd, maxAcd := le.GetQOSLimits() if minAsr != 1.2 || maxAsr != -1 || - minAcd != -1 || maxAcd != time.Duration(67)*time.Minute { + minAcd != -1 || maxAcd != 67*time.Minute { t.Error("Wrong qos limits parsed: ", minAsr, maxAsr, minAcd, maxAcd) } } diff --git a/engine/responder_test.go b/engine/responder_test.go index f3bf8b945..004386c97 100644 --- a/engine/responder_test.go +++ b/engine/responder_test.go @@ -295,8 +295,8 @@ func TestGetLCRStatic(t *testing.T) { eLcr := &LCRCost{ Entry: &LCREntry{DestinationId: utils.ANY, RPCategory: "call", Strategy: LCR_STRATEGY_STATIC, StrategyParams: "dan;rif", Weight: 10.0}, SupplierCosts: []*LCRSupplierCost{ - &LCRSupplierCost{Supplier: "*out:cgrates.org:call:dan", Cost: 0.6, Duration: "60s"}, - &LCRSupplierCost{Supplier: "*out:cgrates.org:call:rif", Cost: 1.2, Duration: "60s"}, + &LCRSupplierCost{Supplier: "*out:cgrates.org:call:dan", Cost: 0.6, Duration: 60 * time.Second}, + &LCRSupplierCost{Supplier: "*out:cgrates.org:call:rif", Cost: 1.2, Duration: 60 * time.Second}, }, } var lcr LCRCost