View | Details | Raw Unified | Return to bug 8514 | Differences between
and this patch

Collapse All | Expand All

(-)a/classes/statistics/MetricsDAO.inc.php (-2 / +5 lines)
 Lines 30-41   class MetricsDAO extends DAO { Link Here 
30
	 * @param $filters array report-level filter selection
30
	 * @param $filters array report-level filter selection
31
	 * @param $orderBy array order criteria
31
	 * @param $orderBy array order criteria
32
	 * @param $range null|DBResultRange paging specification
32
	 * @param $range null|DBResultRange paging specification
33
	 * @param $nonAdditive boolean (optional) Whether the metric type dimension
34
	 * will be additive or not. This must be used with care, different metric types
35
	 * should not be additive because they may diverge in ways of counting usage events.
33
	 *
36
	 *
34
	 * @return null|array The selected data as a simple tabular result set or
37
	 * @return null|array The selected data as a simple tabular result set or
35
	 *  null if metrics are not supported by this plug-in, the specified report
38
	 *  null if metrics are not supported by this plug-in, the specified report
36
	 *  is invalid or cannot be produced or another error occurred.
39
	 *  is invalid or cannot be produced or another error occurred.
37
	 */
40
	 */
38
	function &getMetrics($metricType, $columns = array(), $filters = array(), $orderBy = array(), $range = null) {
41
	function &getMetrics($metricType, $columns = array(), $filters = array(), $orderBy = array(), $range = null, $nonAdditive = true) {
39
		// Return by reference.
42
		// Return by reference.
40
		$nullVar = null;
43
		$nullVar = null;
41
44
 Lines 72-78   class MetricsDAO extends DAO { Link Here 
72
		// either require a filter on a single metric type or the metric type
75
		// either require a filter on a single metric type or the metric type
73
		// must be present as a column.
76
		// must be present as a column.
74
		if (empty($metricType)) return $nullVar;
77
		if (empty($metricType)) return $nullVar;
75
		if (count($metricType) !== 1) {
78
		if (count($metricType) !== 1 && $nonAdditive) {
76
			if (!in_array(STATISTICS_DIMENSION_METRIC_TYPE, $columns)) {
79
			if (!in_array(STATISTICS_DIMENSION_METRIC_TYPE, $columns)) {
77
				array_push($columns, STATISTICS_DIMENSION_METRIC_TYPE);
80
				array_push($columns, STATISTICS_DIMENSION_METRIC_TYPE);
78
			}
81
			}

Return to bug 8514