rounding the values

This commit is contained in:
Justin Otherguy 2011-01-08 12:01:22 +01:00
parent b5f7ffcf35
commit e231f75ac1
2 changed files with 2 additions and 2 deletions

View file

@ -83,7 +83,7 @@ class MeterInterpreter extends Interpreter {
* @todo reimplement according to new env
*/
public function getAverage() {
return $this->getConsumption() / ($this->to - $this->from) * 1000; // return W
return round($this->getConsumption() / ($this->to - $this->from) * 1000, 1); // return W
}
/**

View file

@ -87,7 +87,7 @@ class SensorInterpreter extends Interpreter {
* @return float
*/
public function getLast() {
return (float) $this->conn->fetchColumn('SELECT value FROM data WHERE channel_id = ?' . parent::buildDateTimeFilterSQL($this->from, $this->to). ' ORDER BY timestamp DESC', array($this->channel->getId()), 0);
return round((float) $this->conn->fetchColumn('SELECT value FROM data WHERE channel_id = ?' . parent::buildDateTimeFilterSQL($this->from, $this->to). ' ORDER BY timestamp DESC', array($this->channel->getId()), 0), 1);
}
/**