Merge tag 'v9.78' into develop
bug fix
This commit is contained in:
@@ -693,49 +693,34 @@ def handle_strava_import_stroke_data(title,
|
||||
|
||||
r = type('Rower', (object,), {"stravatoken": stravatoken})
|
||||
|
||||
spmjson = get_strava_stream(r,'cadence',stravaid)
|
||||
hrjson = get_strava_stream(r,'heartrate',stravaid)
|
||||
timejson = get_strava_stream(r,'time',stravaid)
|
||||
velojson = get_strava_stream(r,'velocity_smooth',stravaid)
|
||||
distancejson = get_strava_stream(r,'distance',stravaid)
|
||||
latlongjson = get_strava_stream(r,'latlng',stravaid)
|
||||
wattsjson = get_strava_stream(r,'watts',stravaid)
|
||||
spm = get_strava_stream(r,'cadence',stravaid)
|
||||
hr = get_strava_stream(r,'heartrate',stravaid)
|
||||
t = get_strava_stream(r,'time',stravaid)
|
||||
velo = get_strava_stream(r,'velocity_smooth',stravaid)
|
||||
d = get_strava_stream(r,'distance',stravaid)
|
||||
coords = get_strava_stream(r,'latlng',stravaid)
|
||||
power = 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'])
|
||||
if nr_rows == 0:
|
||||
return 0
|
||||
except IndexError:
|
||||
d = 0*t
|
||||
# return (0,"Error: No Distance information in the Strava data")
|
||||
except KeyError:
|
||||
nr_rows = len(t)
|
||||
|
||||
if nr_rows == 0:
|
||||
return 0
|
||||
|
||||
try:
|
||||
spm = np.array(spmjson.json()[1]['data'])
|
||||
except:
|
||||
if d is None:
|
||||
d = 0*t
|
||||
|
||||
if spm is None:
|
||||
spm = np.zeros(nr_rows)
|
||||
|
||||
try:
|
||||
watts = np.array(wattsjson.json()[1]['data'])
|
||||
except:
|
||||
watts = np.zeros(nr_rows)
|
||||
|
||||
try:
|
||||
hr = np.array(hrjson.json()[1]['data'])
|
||||
except IndexError:
|
||||
hr = np.zeros(nr_rows)
|
||||
except KeyError:
|
||||
if power is None:
|
||||
power = np.zeros(nr_rows)
|
||||
|
||||
if hr is None:
|
||||
hr = np.zeros(nr_rows)
|
||||
|
||||
if velo is None:
|
||||
velo = np.zeros(nr_rows)
|
||||
|
||||
try:
|
||||
velo = np.array(velojson.json()[1]['data'])
|
||||
except IndexError:
|
||||
velo = np.zeros(nr_rows)
|
||||
except KeyError:
|
||||
velo = np.zeros(nr_rows)
|
||||
|
||||
f = np.diff(t).mean()
|
||||
if f != 0:
|
||||
@@ -748,14 +733,14 @@ def handle_strava_import_stroke_data(title,
|
||||
else:
|
||||
velo2 = velo
|
||||
|
||||
coords = np.array(latlongjson.json()[0]['data'])
|
||||
try:
|
||||
lat = coords[:,0]
|
||||
lon = coords[:,1]
|
||||
except IndexError:
|
||||
lat = np.zeros(len(t))
|
||||
lon = np.zeros(len(t))
|
||||
except KeyError:
|
||||
if coords is not None:
|
||||
try:
|
||||
lat = coords[:,0]
|
||||
lon = coords[:,1]
|
||||
except IndexError:
|
||||
lat = np.zeros(len(t))
|
||||
lon = np.zeros(len(t))
|
||||
else:
|
||||
lat = np.zeros(len(t))
|
||||
lon = np.zeros(len(t))
|
||||
|
||||
@@ -789,7 +774,7 @@ def handle_strava_import_stroke_data(title,
|
||||
' AverageDriveForce (lbs)':np.zeros(nr_strokes),
|
||||
' PeakDriveForce (lbs)':np.zeros(nr_strokes),
|
||||
' lapIdx':np.zeros(nr_strokes),
|
||||
' Power (watts)':watts,
|
||||
' Power (watts)':power,
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user