From 0d311b0a087e5e2c0020117c78726131c30eff2d Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 10 Mar 2019 13:14:31 +0100 Subject: [PATCH] Fix timestamp generation --- lib/Interpreter/Interpreter.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Interpreter/Interpreter.php b/lib/Interpreter/Interpreter.php index 0cd6c69ca..ad2bb81ee 100644 --- a/lib/Interpreter/Interpreter.php +++ b/lib/Interpreter/Interpreter.php @@ -203,14 +203,13 @@ protected function getData() { $this->from = (double)$from; // bigint conversion } if (isset($this->to)) { - $sql = 'SELECT MIN(timestamp) FROM data WHERE channel_id=? AND timestamp>?'; -/* + // $sql = 'SELECT MIN(timestamp) FROM data WHERE channel_id=? AND timestamp>?'; // avoid generating timestamps outside the requested range for consumption $sql = ($this->hasOption('consumption') || $this->hasOption('consumptionto')) ? 'SELECT MAX(timestamp) FROM data WHERE channel_id=? AND timestamp?'; -*/ - $to = $this->conn->fetchColumn($sql, array($this->channel->getId(), $this->to), 0); + + $to = $this->conn->fetchColumn($sql, array($this->channel->getId(), $this->to), 0); if ($to) $this->to = (double)$to; // bigint conversion }