fixed
This commit is contained in:
@@ -316,11 +316,10 @@ def get_workout(user,stravaid):
|
||||
latlongjson = get_strava_stream(r,'latlng',stravaid)
|
||||
powerjson = get_strava_stream(r,'power',stravaid)
|
||||
|
||||
|
||||
try:
|
||||
t = np.array(timejson.json()[0]['data'])
|
||||
nr_rows = len(t)
|
||||
d = np.array(distancejson.json()[1]['data'])
|
||||
d = np.array(distancejson.json()[0]['data'])
|
||||
if nr_rows == 0:
|
||||
return (0,"Error: Time data had zero length")
|
||||
|
||||
@@ -331,24 +330,24 @@ def get_workout(user,stravaid):
|
||||
return (0,"something went wrong with the Strava import")
|
||||
|
||||
try:
|
||||
spm = np.array(spmjson.json()[1]['data'])
|
||||
spm = np.array(spmjson.json()[0]['data'])
|
||||
except:
|
||||
spm = np.zeros(nr_rows)
|
||||
|
||||
try:
|
||||
power = np.array(powerjson.json()[1]['data'])
|
||||
power = np.array(powerjson.json()[0]['data'])
|
||||
except IndexError:
|
||||
power = np.zeros(nr_rows)
|
||||
|
||||
try:
|
||||
hr = np.array(hrjson.json()[1]['data'])
|
||||
hr = np.array(hrjson.json()[0]['data'])
|
||||
except IndexError:
|
||||
hr = np.zeros(nr_rows)
|
||||
except KeyError:
|
||||
hr = np.zeros(nr_rows)
|
||||
|
||||
try:
|
||||
velo = np.array(velojson.json()[1]['data'])
|
||||
velo = np.array(velojson.json()[0]['data'])
|
||||
except IndexError:
|
||||
velo = np.zeros(nr_rows)
|
||||
except KeyError:
|
||||
@@ -389,7 +388,6 @@ def get_workout(user,stravaid):
|
||||
'power':power,
|
||||
'strokelength':strokelength,
|
||||
})
|
||||
|
||||
|
||||
# startdatetime = datetime.datetime.strptime(startdatetime,"%Y-%m-%d-%H:%M:%S")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user