Add switch instead of if

This commit is contained in:
TeoV
2018-07-30 08:37:59 -04:00
committed by Dan Christian Bogos
parent 6538483e55
commit 55bcc28169
2 changed files with 7 additions and 4 deletions

View File

@@ -100,7 +100,8 @@ func (sSpls *SortedSuppliers) SortQOS(params []string) {
if sSpls.SortedSuppliers[i].worstStats[param] == sSpls.SortedSuppliers[j].worstStats[param] {
continue
}
if sSpls.SortedSuppliers[i].worstStats[param] == -1 {
if (param != utils.MetaPDD && sSpls.SortedSuppliers[i].worstStats[param] == -1) ||
(param == utils.MetaPDD && sSpls.SortedSuppliers[i].worstStats[param] == 1000000) {
return false
}
switch param {

View File

@@ -68,9 +68,11 @@ func (lcs *QOSSupplierSorter) SortSuppliers(prflID string, suppls []*Supplier,
}
}
}
if hasMetric == false { //if not have populate with default value
srtData[metric] = -1
if metric == utils.MetaPDD {
if !hasMetric { //if not have populate with default value
switch metric {
default:
srtData[metric] = -1
case utils.MetaPDD:
srtData[metric] = 1000000
}
}