diff --git a/app/Repositories/Metric/AbstractMetricRepository.php b/app/Repositories/Metric/AbstractMetricRepository.php index 40b5f8ced7ed..be72f73ab5f6 100644 --- a/app/Repositories/Metric/AbstractMetricRepository.php +++ b/app/Repositories/Metric/AbstractMetricRepository.php @@ -50,13 +50,14 @@ public function __construct(Repository $config) /** * Get the table names prefix. * - * @return string + * @return string */ protected function getPrefix() { $driver = $this->config->get('database.default'); $connection = $this->config->get('database.connections.'.$driver); $prefix = $connection['prefix']; + return $prefix; } @@ -68,17 +69,19 @@ protected function getPrefix() protected function getTableName() { $prefix = $this->getPrefix(); + return $prefix.'metrics'; } /** * Get the metric points table name. * - * @return string + * @return string */ protected function getMetricPointsTableName() { $prefix = $this->getPrefix(); + return $prefix.'metric_points'; } } diff --git a/app/Repositories/Metric/MySqlRepository.php b/app/Repositories/Metric/MySqlRepository.php index 9c32f8f23c83..ed3fc39dd5f8 100644 --- a/app/Repositories/Metric/MySqlRepository.php +++ b/app/Repositories/Metric/MySqlRepository.php @@ -38,7 +38,6 @@ public function getPointsLastHour(Metric $metric, $hour, $minute) $timeInterval = $dateTime->format('YmdHi'); $metricPointsTableName = $this->getMetricPointsTableName(); - if (!isset($metric->calc_type) || $metric->calc_type == Metric::CALC_SUM) { $queryType = 'SUM(mp.`value` * mp.`counter`) AS `value`'; } elseif ($metric->calc_type == Metric::CALC_AVG) {