From d0fec47b6d956ee60cc77222588864b8efcefa6c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 15 Jan 2018 16:56:08 +0100 Subject: [statistics] Fix runtime filter (had math backwards) --- modules-available/statistics/inc/filter.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules-available') diff --git a/modules-available/statistics/inc/filter.inc.php b/modules-available/statistics/inc/filter.inc.php index 1686f328..f6765059 100644 --- a/modules-available/statistics/inc/filter.inc.php +++ b/modules-available/statistics/inc/filter.inc.php @@ -155,19 +155,19 @@ class RuntimeFilter extends Filter public function whereClause(&$args, &$joins) { global $SIZE_RAM; - $lower = time() + (int)$this->argument * 3600; - $upper = $lower + 3600; + $upper = time() - (int)$this->argument * 3600; + $lower = $upper - 3600; $common = "state IN ('OCCUPIED', 'IDLE', 'STANDBY') AND"; if ($this->operator == '=') { return "$common ({$this->column} BETWEEN $lower AND $upper)"; } elseif ($this->operator == '<') { - return "$common {$this->column} < $lower"; + return "$common {$this->column} > $upper"; } elseif ($this->operator == '<=') { - return "$common {$this->column} < $upper"; + return "$common {$this->column} > $lower"; } elseif ($this->operator == '>') { - return "$common {$this->column} > $upper"; + return "$common {$this->column} < $lower"; } elseif ($this->operator == '>=') { - return "$common {$this->column} > $lower"; + return "$common {$this->column} < $upper"; } elseif ($this->operator == '!=') { return "$common ({$this->column} < $lower OR {$this->column} > $upper)"; } else { -- cgit v1.2.3-55-g7522