Private
Public Access
1
0

more try and except in stravastuff as bugfix

This commit is contained in:
Sander Roosendaal
2020-09-08 21:58:13 +02:00
parent bb19e2ff51
commit 83088e1139

View File

@@ -834,12 +834,31 @@ def handle_strava_import_stroke_data(title,
r = type('Rower', (object,), {"stravatoken": stravatoken})
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,'watts',stravaid)
try:
hr = get_strava_stream(r,'heartrate',stravaid)
except JSONDecodeError:
hr = 0*spm
try:
velo = get_strava_stream(r,'velocity_smooth',stravaid)
except JSONDecodeError:
velo = 0*t
try:
d = get_strava_stream(r,'distance',stravaid)
except JSONDecodeError:
d = 0*t
try:
coords = get_strava_stream(r,'latlng',stravaid)
except JSONDecodeError:
coords = 0*t
try:
power = get_strava_stream(r,'watts',stravaid)
except JSONDecodeError:
power = 0*t
if t is not None:
nr_rows = len(t)