diff --git a/app/Models/MetricPoint.php b/app/Models/MetricPoint.php index db0daf37d..89d531013 100644 --- a/app/Models/MetricPoint.php +++ b/app/Models/MetricPoint.php @@ -83,8 +83,6 @@ class MetricPoint extends Model implements HasPresenter { if ($this->metric->calc_type === Metric::CALC_SUM) { return round((float) $value * $this->counter, $this->metric->places); - } elseif ($this->metric->calc_type === Metric::CALC_AVG) { - return round((float) $value * $this->counter, $this->metric->places); } return round((float) $value, $this->metric->places); diff --git a/app/Repositories/Metric/AbstractMetricRepository.php b/app/Repositories/Metric/AbstractMetricRepository.php index f63f3e0fc..4c14cc6b6 100644 --- a/app/Repositories/Metric/AbstractMetricRepository.php +++ b/app/Repositories/Metric/AbstractMetricRepository.php @@ -85,7 +85,7 @@ abstract class AbstractMetricRepository if (!isset($metric->calc_type) || $metric->calc_type == Metric::CALC_SUM) { return "sum({$this->getMetricPointsTable()}.value * {$this->getMetricPointsTable()}.counter) AS value"; } elseif ($metric->calc_type == Metric::CALC_AVG) { - return "avg({$this->getMetricPointsTable()}.value * {$this->getMetricPointsTable()}.counter) AS value"; + return "avg({$this->getMetricPointsTable()}.value) AS value"; } else { return "sum({$this->getMetricPointsTable()}.value * {$this->getMetricPointsTable()}.counter) AS value"; }