rounding the values
This commit is contained in:
parent
b5f7ffcf35
commit
e231f75ac1
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue