keep *default queue on reload and revive rounding

This commit is contained in:
Radu Ioan Fericean
2014-08-01 21:43:01 +03:00
parent b86a8c77ba
commit dd08456d13
2 changed files with 13 additions and 4 deletions

View File

@@ -143,6 +143,11 @@ func (s *Stats) UpdateQueues(css []*CdrStats, out *int) error {
defer s.mux.Unlock()
oldQueues := s.queues
s.queues = make(map[string]*StatsQueue, len(css))
if def, exists := oldQueues[utils.META_DEFAULT]; exists {
// for reset
def.UpdateConf(def.conf)
s.queues[utils.META_DEFAULT] = def
}
for _, cs := range css {
var sq *StatsQueue
var existing bool

View File

@@ -18,7 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package engine
import "time"
import (
"time"
"github.com/cgrates/cgrates/utils"
)
type Metric interface {
AddCdr(*QCdr)
@@ -68,7 +72,7 @@ func (asr *ASRMetric) GetValue() float64 {
return 0
}
val := asr.answered / asr.total * 100
return val //utils.Round(val, globalRoundingDecimals, utils.ROUNDING_MIDDLE)
return utils.Round(val, globalRoundingDecimals, utils.ROUNDING_MIDDLE)
}
// ACD Average Call Duration
@@ -97,7 +101,7 @@ func (acd *ACDMetric) GetValue() float64 {
return 0
}
val := acd.sum.Seconds() / acd.count
return val //utils.Round(val, globalRoundingDecimals, utils.ROUNDING_MIDDLE)
return utils.Round(val, globalRoundingDecimals, utils.ROUNDING_MIDDLE)
}
// ACC Average Call Cost
@@ -126,5 +130,5 @@ func (acc *ACCMetric) GetValue() float64 {
return 0
}
val := acc.sum / acc.count
return val //utils.Round(val, globalRoundingDecimals, utils.ROUNDING_MIDDLE)
return utils.Round(val, globalRoundingDecimals, utils.ROUNDING_MIDDLE)
}