Skip to content

Commit

Permalink
Ensure correct aggregation of min/max event value metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Jul 2, 2024
1 parent 066339f commit 9b95430
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions plugins/Events/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Piwik\Plugins\Events;

use Piwik\Archive;
use Piwik\DataTable;
use Piwik\Piwik;

/**
Expand Down Expand Up @@ -166,6 +167,12 @@ protected function getDataTable($name, $idSite, $period, $date, $segment, $expan
}));
}

$dataTable->filter(function ($dataTable) {
$dataTable->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, [
'max_event_value' => 'max',
'min_event_value' => 'min',
]);
});
$dataTable->filter('Piwik\Plugins\Events\DataTable\Filter\ReplaceEventNameNotSet');

return $dataTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
<nb_events>69</nb_events>
<nb_events_with_value>14</nb_events_with_value>
<sum_event_value>137.96</sum_event_value>
<min_event_value>28.32</min_event_value>
<max_event_value>52.32</max_event_value>
<min_event_value>0</min_event_value>
<max_event_value>23</max_event_value>
</reportTotal>
</result>

0 comments on commit 9b95430

Please sign in to comment.