From d4c296ca348906da0bfe44c7fe9280685941116f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 2 Mar 2011 01:17:20 +0100 Subject: [PATCH] fixed invalid array indexes for min/max output --- lib/Interpreter/SensorInterpreter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Interpreter/SensorInterpreter.php b/lib/Interpreter/SensorInterpreter.php index 5026cf7..0b03dbe 100644 --- a/lib/Interpreter/SensorInterpreter.php +++ b/lib/Interpreter/SensorInterpreter.php @@ -57,7 +57,7 @@ class SensorInterpreter extends Interpreter { * @return array (0 => timestamp, 1 => value) */ public function getMin() { - $min = $this->conn->fetchAssoc('SELECT value, timestamp FROM data WHERE channel_id = ?' . parent::buildDateTimeFilterSQL($this->from, $this->to) . ' ORDER BY value ASC LIMIT 1', array($this->channel->getId())); + $min = $this->conn->fetchArray('SELECT timestamp, value FROM data WHERE channel_id = ?' . parent::buildDateTimeFilterSQL($this->from, $this->to) . ' ORDER BY value ASC LIMIT 1', array($this->channel->getId())); return ($min) ? array_map('floatval', $min) : NULL; } @@ -67,7 +67,7 @@ class SensorInterpreter extends Interpreter { * @return array (0 => timestamp, 1 => value) */ public function getMax() { - $max = $this->conn->fetchAssoc('SELECT value, timestamp FROM data WHERE channel_id = ?' . parent::buildDateTimeFilterSQL($this->from, $this->to) . ' ORDER BY value DESC LIMIT 1', array($this->channel->getId())); + $max = $this->conn->fetchArray('SELECT timestamp, value FROM data WHERE channel_id = ?' . parent::buildDateTimeFilterSQL($this->from, $this->to) . ' ORDER BY value DESC LIMIT 1', array($this->channel->getId())); return ($max) ? array_map('floatval', $max) : NULL; }