From 8ab93bf13c55bf6d8f43ecb157e7a95756d2dd62 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 12 Jun 2020 17:53:43 +0200 Subject: [PATCH] fix bug --- rowers/interactiveplots.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 754c651c..62ea13ee 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -2064,16 +2064,19 @@ def leaflet_chart(lat,lon,name=""): def leaflet_chart_compare(course,workoutids,labeldict={},startenddict={}): data = [] for id in workoutids: - w = Workout.objects.get(id=id) - rowdata = rdata(w.csvfilename) - time = rowdata.df['TimeStamp (sec)'] - df = pd.DataFrame({ - 'workoutid':id, - 'lat':rowdata.df[' latitude'], - 'lon':rowdata.df[' longitude'], - 'time':time-time[0], - }) - data.append(df) + try: + w = Workout.objects.get(id=id) + rowdata = rdata(w.csvfilename) + time = rowdata.df['TimeStamp (sec)'] + df = pd.DataFrame({ + 'workoutid':id, + 'lat':rowdata.df[' latitude'], + 'lon':rowdata.df[' longitude'], + 'time':time-time[0], + }) + data.append(df) + except Workout.DoesNotExist: + pass df = pd.concat(data,axis=0)