From f8d22a321c5933ca8d08565754f841e989b96b94 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 1 Mar 2011 23:49:38 +0100 Subject: [PATCH] added exception for consumption and SensorInterpreters --- lib/View/JSON.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/View/JSON.php b/lib/View/JSON.php index 76dd67e..80af0b7 100644 --- a/lib/View/JSON.php +++ b/lib/View/JSON.php @@ -228,7 +228,11 @@ class JSON extends View { $this->json['data']['min'] = $interpreter->getMin(); $this->json['data']['max'] = $interpreter->getMax(); $this->json['data']['average'] = View::formatNumber($interpreter->getAverage()); - $this->json['data']['consumption'] = View::formatNumber($interpreter->getConsumption()); + + if ($interpreter instanceof Interpreter\MeterInterpreter) { + $this->json['data']['consumption'] = View::formatNumber($interpreter->getConsumption()); + } + $this->json['data']['count'] = $interpreter->getTupleCount(); if (count($data) > 0) $this->json['data']['tuples'] = $data; }