summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2019-12-13 17:36:51 +0100
committerSimon Rettberg2019-12-13 17:36:51 +0100
commite90884555e1a339d07958691c44b89a48f8d4833 (patch)
treeb052add0f100c710387817c8f858944081c3788a /modules-available
parent[rebootcontrol] Fix incomplete query (diff)
downloadslx-admin-e90884555e1a339d07958691c44b89a48f8d4833.tar.gz
slx-admin-e90884555e1a339d07958691c44b89a48f8d4833.tar.xz
slx-admin-e90884555e1a339d07958691c44b89a48f8d4833.zip
[statistics] Fix date range queries to match by day, not by second
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/statistics/inc/statisticsfilter.inc.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules-available/statistics/inc/statisticsfilter.inc.php b/modules-available/statistics/inc/statisticsfilter.inc.php
index 934e01da..c5d2f0f2 100644
--- a/modules-available/statistics/inc/statisticsfilter.inc.php
+++ b/modules-available/statistics/inc/statisticsfilter.inc.php
@@ -55,12 +55,22 @@ class StatisticsFilter
/* returns a where clause and adds needed operators to the passed array */
public function whereClause(&$args, &$joins)
{
- $key = StatisticsFilter::getNewKey($this->column);
+ $key = self::getNewKey($this->column);
$addendum = '';
/* check if we have to do some parsing*/
if (self::$columns[$this->column]['type'] === 'date') {
$args[$key] = strtotime($this->argument);
+ if ($this->operator === '=' || $this->operator === '!=') {
+ $key2 = self::getNewKey($this->column);
+ $args[$key2] = strtotime(' +1 day', $args[$key]);
+ return ($this->operator === '=' ? '' : 'NOT ') . 'm.' . $this->column . " BETWEEN :$key AND :$key2";
+ }
+ if ($this->operator === '>') {
+ $args[$key] = strtotime('+1 day', $args[$key]);
+ } elseif ($this->operator === '<') {
+ $args[$key] = strtotime('-1 day', $args[$key]);
+ }
} else {
$args[$key] = $this->argument;
if ($this->operator === '~' || $this->operator === '!~') {