MCPcopy Create free account
hub / github.com/Rello/analytics / aggregateData

Method aggregateData

lib/Controller/DatasourceController.php:617–635  ·  view source on GitHub ↗
($data, $filter)

Source from the content-addressed store, hash-verified

615 }
616
617 private function aggregateData($data, $filter) {
618 $options = json_decode($filter, true);
619 if (!is_array($options)) {
620 $options = [];
621 }
622
623 $header = isset($data['header']) && is_array($data['header']) ? $data['header'] : [];
624 $dimensionCount = max(count($header) - 1, 0);
625 $hiddenDrilldownIndices = $this->getHiddenDrilldownIndices($options, $dimensionCount);
626 if (!empty($hiddenDrilldownIndices)) {
627 $data = $this->removeColumnsByIndex($data, $hiddenDrilldownIndices);
628 }
629
630 if (!$this->shouldAggregate($options)) {
631 return $data;
632 }
633
634 return $this->aggregateRows($data);
635 }
636
637 private function normalizeFilterOptionsForData($filterOptions, array $header): string {
638 if (!is_string($filterOptions) || trim($filterOptions) === '') {

Callers 1

readMethod · 0.95

Calls 5

removeColumnsByIndexMethod · 0.95
shouldAggregateMethod · 0.95
aggregateRowsMethod · 0.95
countFunction · 0.50

Tested by

no test coverage detected