From 11d6716b5451ee3747a22741a5c0f643bf772a0e Mon Sep 17 00:00:00 2001 From: Pim van Gennip Date: Tue, 24 Nov 2020 16:17:47 +0100 Subject: [PATCH] Update ResearchController.php --- app/Http/Controllers/ResearchController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ResearchController.php b/app/Http/Controllers/ResearchController.php index c2f68448..ecab0d7a 100644 --- a/app/Http/Controllers/ResearchController.php +++ b/app/Http/Controllers/ResearchController.php @@ -400,7 +400,7 @@ public function show($id, Request $request) $user_device_keys = '('.implode(' OR ', $user_device_keys).')'; try{ - $points = $influx::query('SELECT COUNT("time") as "count" FROM "sensors" WHERE '.$user_device_keys.' AND time >= \''.$user_consents[0]->updated_at.'\' AND time <= \''.$moment_end->format('Y-m-d H:i:s').'\' GROUP BY time(1d)')->getPoints(); + $points = $influx::query('SELECT COUNT("bv") as "count" FROM "sensors" WHERE '.$user_device_keys.' AND time >= \''.$user_consents[0]->updated_at.'\' AND time <= \''.$moment_end->format('Y-m-d H:i:s').'\' GROUP BY time(1d)')->getPoints(); } catch (InfluxDB\Exception $e) { // return Response::json('influx-group-by-query-error', 500); } @@ -413,7 +413,7 @@ public function show($id, Request $request) // Add weather data $user_location_coord_where = '('.implode(' OR ', $user_dloc_coords).')'; try{ - $weather = $influx::query('SELECT COUNT("time") as "count" FROM "weather" WHERE '.$user_location_coord_where.' AND time >= \''.$user_consents[0]->updated_at.'\' AND time <= \''.$moment_end->format('Y-m-d H:i:s').'\' GROUP BY time(1d)')->getPoints(); // get first weather date + $weather = $influx::query('SELECT COUNT("temperature") as "count" FROM "weather" WHERE '.$user_location_coord_where.' AND time >= \''.$user_consents[0]->updated_at.'\' AND time <= \''.$moment_end->format('Y-m-d H:i:s').'\' GROUP BY time(1d)')->getPoints(); // get first weather date } catch (InfluxDB\Exception $e) { // return Response::json('influx-group-by-query-error', 500); }