summaryrefslogtreecommitdiff
path: root/dashboard_website
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard_website')
-rw-r--r--dashboard_website/dashboard.py4
-rw-r--r--dashboard_website/db.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/dashboard_website/dashboard.py b/dashboard_website/dashboard.py
index 793fcfd..78fb355 100644
--- a/dashboard_website/dashboard.py
+++ b/dashboard_website/dashboard.py
@@ -92,10 +92,12 @@ def requestRoute():
if clue == None:
return jsonify({'status' : "ERROR 5"})
- route = getRouteFullJSON(bike, clue)
+ route = router.getRouteFullJSON(bike, clue)
if route['code'] != 'Ok': # or some other code indicating routing problem?
return jsonify({'status' : "ERROR 6"})
+ db.reassignIndividualRoute(bike, route) # update displayed route on dashboard
+
reply = {"status" : "OK",
"clue_name" : clue.name,
"clue_long" : clue.longitude,
diff --git a/dashboard_website/db.py b/dashboard_website/db.py
index e1c5970..eb0adec 100644
--- a/dashboard_website/db.py
+++ b/dashboard_website/db.py
@@ -57,6 +57,11 @@ def updateRoutes(): # if necessary
def getTime():
return time.time()
+def reassignIndividualRoute(bike, route_json):
+ for i, b in enumerate(bikes):
+ if b.name == bike.name:
+ routes['individual_routes'][i] = route_json['routes'][0]['geometry']['coordinates']
+ return
def getHomeBaseJSON(timestamp):
if timestamp < 0 or home_last_changed - timestamp > 0: