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

Method aggregateData

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

Source from the content-addressed store, hash-verified

448 }
449
450 private function aggregateData($data, $filter) {
451 $options = json_decode($filter, true);
452 if (!is_array($options)) {
453 $options = [];
454 }
455
456 $header = isset($data['header']) && is_array($data['header']) ? $data['header'] : [];
457 $dimensionCount = max(count($header) - 1, 0);
458 $hiddenDrilldownIndices = $this->getHiddenDrilldownIndices($options, $dimensionCount);
459 if (!empty($hiddenDrilldownIndices)) {
460 $data = $this->removeColumnsByIndex($data, $hiddenDrilldownIndices);
461 }
462
463 if (!$this->shouldAggregate($options)) {
464 return $data;
465 }
466
467 return $this->aggregateRows($data);
468 }
469
470 private function normalizeFilterOptionsForData($filterOptions, array $header): string {
471 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