Private
Public Access
1
0

fixes and extra logging

This commit is contained in:
Sander Roosendaal
2021-11-09 21:30:11 +01:00
parent 919e7f331b
commit 806e5837f9
5 changed files with 26 additions and 9 deletions

View File

@@ -341,6 +341,7 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
dologging('strava_fail.log','Strava upload failed for Workout {id}'.format(id=workoutid))
failed = True
except FileNotFoundError: # pragma: no cover
dologging('strava_fail.log','Strava upload failed for Workout {id}'.format(id=workoutid))
failed = True
if not failed:
@@ -348,21 +349,21 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
try:
act = client.update_activity(res.id,activity_type=activity_type,
description=description,device_name='Rowsandall.com')
dologging('stravalog.log','Updating activity {id} to {type}'.format(
dologging('strava_export_log.log','Updating activity {id} to {type}'.format(
id=workoutid,
type=activity_type
))
except TypeError: # pragma: no cover
act = client.update_activity(res.id,activity_type=activity_type,
description=description)
dologging('stravalog.log','Updating activity {id} to {type}'.format(
dologging('strava_export_log.log','Updating activity {id} to {type}'.format(
id=workoutid,
type=activity_type
))
except: # pragma: no cover
e = sys.exc_info()[0]
dologging('stravalog.log','Update activity failed with error {e} for {id} to {type}'.format(
dologging('strava_export_log.log','Update activity failed with error {e} for {id} to {type}'.format(
id=workoutid,
type=activity_type,
e=e
@@ -3168,7 +3169,7 @@ def df_from_summary(data):
distances = [0]
try:
spms = [splits[0]['stroke_rate']]
except (KeyError, TypeError): # pragma: no cover
except (KeyError, TypeError, IndexError): # pragma: no cover
spms = [0]
try:
hrs = [splits[0]['heart_rate']['average']]
@@ -3298,9 +3299,13 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone
strokedata = pd.DataFrame.from_dict(s.json()['data'])
res = make_cumvalues(0.1*strokedata['t'])
cum_time = res[0]
lapidx = res[1]
try:
res = make_cumvalues(0.1*strokedata['t'])
cum_time = res[0]
lapidx = res[1]
except KeyError:
dologging('debuglog.log','No time values in stroke data')
return 0
unixtime = cum_time+starttimeunix