public function aggregateNumericMetrics($columns, $operationToApply = false)
    {
        $metrics = $this->getAggregatedNumericMetrics($columns, $operationToApply);

        foreach ($metrics as $column => $value) {
            $value = Common::forceDotAsSeparatorForDecimalPoint($value);
            $this->archiveWriter->insertRecord($column, $value);
        }
        // if asked for only one field to sum
        if (count($metrics) == 1) {
            return reset($metrics);
        }

        // returns the array of records once summed
        return $metrics;
    }
public function aggregateNumericMetrics($columns, $operationToApply = false)
    {
        $metrics = $this->getAggregatedNumericMetrics($columns, $operationToApply);

        foreach ($metrics as $column => $value) {
            $value = Common::forceDotAsSeparatorForDecimalPoint($value);
            $this->archiveWriter->insertRecord($column, $value);
        }
        // if asked for only one field to sum
        if (count($metrics) == 1) {
            return reset($metrics);
        }

        // returns the array of records once summed
        return $metrics;
    }
public function aggregateNumericMetrics ( $ columns , $ operationToApply = false ) { $ metrics = $ this -> getAggregatedNumericMetrics ( $ columns , $ operationToApply ) ; foreach ( $ metrics as $ column => $ value ) { $ value = Common :: forceDotAsSeparatorForDecimalPoint ( $ value ) ; $ this -> archiveWriter -> insertRecord ( $ column , $ value ) ; } // if asked for only one field to sum if ( count ( $ metrics ) == 1 ) { return reset ( $ metrics ) ; } // returns the array of records once summed return $ metrics ; }
Aggregates one or more metrics for every subperiod of the current period and inserts the results
as metrics for the current period.

@param array|string $columns Array of metric names to aggregate.
@param bool|string $operationToApply The operation to apply to the metric. Either `'sum'`, `'max'` or `'min'`.
@return array|int Returns the array of aggregate values. If only one metric was aggregated,
the aggregate value will be returned as is, not in an array.
For example, if `array('nb_visits', 'nb_hits')` is supplied for `$columns`,

array(
'nb_visits' => 3040,
'nb_hits' => 405
)

could be returned. If `array('nb_visits')` or `'nb_visits'` is used for `$columns`,
then `3040` would be returned.
@api
Aggregates one or more metrics for every subperiod of the current period and inserts the results as metrics for the current period .