unig time.Duration in LcrSupplierCost

This commit is contained in:
Radu Ioan Fericean
2015-04-10 09:49:49 +03:00
parent c281916089
commit 45f8243541
4 changed files with 8 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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