Differential D19814 Diff 47329 src/applications/multimeter/controller/MultimeterSampleController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/multimeter/controller/MultimeterSampleController.php
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | foreach ($group_map as $key => $column) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'%T IN (%Ls)', | '%T IN (%Ls)', | ||||
$column, | $column, | ||||
$with[$key]); | $with[$key]); | ||||
} | } | ||||
} | } | ||||
$where = '('.implode(') AND (', $where).')'; | |||||
$data = queryfx_all( | $data = queryfx_all( | ||||
$conn, | $conn, | ||||
'SELECT *, | 'SELECT *, | ||||
count(*) AS N, | count(*) AS N, | ||||
SUM(sampleRate * resourceCost) AS totalCost, | SUM(sampleRate * resourceCost) AS totalCost, | ||||
SUM(sampleRate * resourceCost) / SUM(sampleRate) AS averageCost | SUM(sampleRate * resourceCost) / SUM(sampleRate) AS averageCost | ||||
FROM %T | FROM %T | ||||
WHERE %Q | WHERE %LA | ||||
GROUP BY %Q | GROUP BY %LC | ||||
ORDER BY totalCost DESC, MAX(id) DESC | ORDER BY totalCost DESC, MAX(id) DESC | ||||
LIMIT 100', | LIMIT 100', | ||||
$table->getTableName(), | $table->getTableName(), | ||||
$where, | $where, | ||||
implode(', ', array_select_keys($group_map, $group))); | array_select_keys($group_map, $group)); | ||||
$this->loadDimensions($data); | $this->loadDimensions($data); | ||||
$phids = array(); | $phids = array(); | ||||
foreach ($data as $row) { | foreach ($data as $row) { | ||||
$viewer_name = $this->getViewerDimension($row['eventViewerID']) | $viewer_name = $this->getViewerDimension($row['eventViewerID']) | ||||
->getName(); | ->getName(); | ||||
$viewer_phid = $this->getEventViewerPHID($viewer_name); | $viewer_phid = $this->getEventViewerPHID($viewer_name); | ||||
if ($viewer_phid) { | if ($viewer_phid) { | ||||
▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines |