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

Method aggregateData

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

Source from the content-addressed store, hash-verified

548 }
549
550 private function aggregateData($data, $filter) {
551 $options = json_decode($filter, true);
552 if (!is_array($options)) {
553 $options = [];
554 }
555
556 $header = isset($data['header']) && is_array($data['header']) ? $data['header'] : [];
557 $dimensionCount = max(count($header) - 1, 0);
558 $hiddenDrilldownIndices = $this->getHiddenDrilldownIndices($options, $dimensionCount);
559 if (!empty($hiddenDrilldownIndices)) {
560 $data = $this->removeColumnsByIndex($data, $hiddenDrilldownIndices);
561 }
562
563 if (!$this->shouldAggregate($options)) {
564 return $data;
565 }
566
567 return $this->aggregateRows($data);
568 }
569
570 private function normalizeFilterOptionsForData($filterOptions, array $header): string {
571 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