Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/Repositories/Metric/AbstractMetricRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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';
}
}
1 change: 0 additions & 1 deletion app/Repositories/Metric/MySqlRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down