From 68575cad899cbdfbe3fdb5db23071a6a5088fe93 Mon Sep 17 00:00:00 2001 From: SNatis Date: Wed, 19 Feb 2025 09:02:32 +0100 Subject: [PATCH] Bug fix Average The statement "count($args) > 2" is present when the function average has only two arguments. When adding the "round" argument, this statement was not adapted. Specifying a rounding in the arguments of the average function causes it to systematically distort the results. --- core/class/scenarioExpression.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/class/scenarioExpression.class.php b/core/class/scenarioExpression.class.php index 13e36108b5..4fe538ef66 100644 --- a/core/class/scenarioExpression.class.php +++ b/core/class/scenarioExpression.class.php @@ -261,7 +261,7 @@ public static function average($_cmd_id, $_period = '1 hour', $_round = 1) { $_period = trim(strtolower($_period)); if ($_period == 'day') $_period = '1 day'; - if (count($args) > 2 || strpos($_period, '#') !== false || is_numeric($_period)) { + if (count($args) > 3 || strpos($_period, '#') !== false || is_numeric($_period)) { $values = array(); foreach ($args as $arg) { if (is_numeric($arg)) {