summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2018-01-15 16:56:08 +0100
committerSimon Rettberg2018-01-15 16:56:08 +0100
commitd0fec47b6d956ee60cc77222588864b8efcefa6c (patch)
tree41c207946ffc5c9ef370a095efbfc7c72735e338 /modules-available
parent[statistics] Fix typo in last commit (diff)
downloadslx-admin-d0fec47b6d956ee60cc77222588864b8efcefa6c.tar.gz
slx-admin-d0fec47b6d956ee60cc77222588864b8efcefa6c.tar.xz
slx-admin-d0fec47b6d956ee60cc77222588864b8efcefa6c.zip
[statistics] Fix runtime filter (had math backwards)
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/statistics/inc/filter.inc.php12
1 files changed, 6 insertions, 6 deletions
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 {