From 171ff79a8557fa9e7f82f845781d9d3d6c26d6f6 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 18 Oct 2010 02:17:01 +0200 Subject: [PATCH] fixed small bug (undefined index if we have no data) --- backend/lib/View/JSON.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/lib/View/JSON.php b/backend/lib/View/JSON.php index c1137d6..fb71a16 100644 --- a/backend/lib/View/JSON.php +++ b/backend/lib/View/JSON.php @@ -147,9 +147,11 @@ class JSON extends View { protected function addData(Interpreter\InterpreterInterface $interpreter) { $data = $interpreter->getValues($this->request->getParameter('tuples'), $this->request->getParameter('group')); - $this->json['data'][] = array( + $this->json['data'] = array( 'uuid' => $interpreter->getUuid(), 'count' => count($data), + 'first' => (isset($data[0][0])) ? $data[0][0] : NULL, + 'last' => (isset($data[count($data)-1][0])) ? $data[count($data)-1][0] : NULL, 'min' => $interpreter->getMin(), 'max' => $interpreter->getMax(), 'average' => $interpreter->getAverage(),