Skip to content

Commit

Permalink
Ignore aggregated rows for totals
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Jan 13, 2025
1 parent e6bac25 commit 19e6c7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/API/DataTableManipulator/ReportTotalsCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ protected function manipulateDataTable($dataTable)
/** @var DataTable\Row $totalRow */
$totalRow = null;
foreach ($firstLevelTable->getRows() as $row) {
if ($row->getMetadata('is_aggregate') == '1') {
continue; // skip aggregated row added by flattening
}

if (!isset($totalRow)) {
$columns = $row->getColumns();
$columns['label'] = DataTable::LABEL_TOTALS_ROW;
Expand Down
3 changes: 2 additions & 1 deletion plugins/API/ProcessedReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ public function getProcessedReport(
'serialize' => '0',
'language' => $language,
'idSubtable' => $idSubtable,
'keep_totals_row' => 1,
));

if (!empty($segment)) {
Expand Down Expand Up @@ -778,7 +779,7 @@ private function handleSimpleDataTable($idSite, $simpleDataTable, $metadataColum

private function aggregateReportTotalValues($simpleDataTable, $metadateColumns, $totals)
{
$metadataTotals = $simpleDataTable->getMetadata('totals');
$metadataTotals = $simpleDataTable->getTotalsRow();

if (empty($metadataTotals)) {
return $totals;
Expand Down

0 comments on commit 19e6c7b

Please sign in to comment.