From e811d94f49beb7dba1259a18a775a06d50989b8a Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 12 Jun 2020 19:14:50 +0200 Subject: [PATCH] fixed --- rowers/interactiveplots.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 021513aa..be7360b5 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -2075,19 +2075,14 @@ def leaflet_chart_compare(course,workoutids,labeldict={},startenddict={}): 'lon':rowdata.df[' longitude'], 'time':time-time[0], }) + data.append(df) except Workout.DoesNotExist: - df = pd.DataFrame({ - 'workoutid':id, - 'lat':[], - 'lon':[]} - ) + pass - data.append(df) df = pd.concat(data,axis=0) - latmean,lonmean,coordinates = course_coord_center(course) lat_min, lat_max, long_min, long_max = course_coord_maxmin(course) @@ -2144,7 +2139,6 @@ def leaflet_chart_compare(course,workoutids,labeldict={},startenddict={}): df.fillna(method='ffill',axis=0,inplace=True) - lat = df['lat'] lon = df['lon'] if lat.empty or lon.empty: @@ -2284,7 +2278,8 @@ def leaflet_chart_compare(course,workoutids,labeldict={},startenddict={}): """.format(x=x,y=y) scoordinates += "]" - script += """ + if not group.empty: + script += """ var latlongs = {scoordinates} var polyline = L.polyline(latlongs, {{color:'{color}'}}).addTo(mymap) polyline.bindPopup("{label}",{{ autoPan: false, autoClose: false }}).openPopup()