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

Method aggregateData

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

Source from the content-addressed store, hash-verified

465 }
466
467 private function aggregateData($data, $filter) {
468 $options = json_decode($filter, true);
469 if (!is_array($options)) {
470 $options = [];
471 }
472
473 $header = isset($data['header']) && is_array($data['header']) ? $data['header'] : [];
474 $dimensionCount = max(count($header) - 1, 0);
475 $hiddenDrilldownIndices = $this->getHiddenDrilldownIndices($options, $dimensionCount);
476 if (!empty($hiddenDrilldownIndices)) {
477 $data = $this->removeColumnsByIndex($data, $hiddenDrilldownIndices);
478 }
479
480 if (!$this->shouldAggregate($options)) {
481 return $data;
482 }
483
484 return $this->aggregateRows($data);
485 }
486
487 private function normalizeFilterOptionsForData($filterOptions, array $header): string {
488 if (!is_string($filterOptions) || trim($filterOptions) === '') {

Callers 1

readMethod · 0.95

Calls 4

removeColumnsByIndexMethod · 0.95
shouldAggregateMethod · 0.95
aggregateRowsMethod · 0.95

Tested by

no test coverage detected