Private
Public Access
1
0

Merge branch 'release/v16.4.21'

This commit is contained in:
Sander Roosendaal
2021-06-30 19:16:29 +02:00
5 changed files with 25 additions and 7 deletions

View File

@@ -700,7 +700,7 @@ def createc2workoutdata(w):
if workouttype in otwtypes:
workouttype = 'water'
if w.timezone == 'tzutc()':
if w.timezone == 'tzutc()': # pragma: no cover
w.timezone = 'UTC'
w.save()

View File

@@ -1844,7 +1844,7 @@ def get_startdate_time_zone(r,row,startdatetime=None):
if startdatetime is not None and startdatetime != '':
try:
timezone_str = pendulum.instance(startdatetime).timezone.name
except ValueError:
except ValueError: # pragma: no cover
timezone_str = 'Ect/GMT'
elif startdatetime == '':
startdatetime = row.rowdatetime
@@ -1853,7 +1853,7 @@ def get_startdate_time_zone(r,row,startdatetime=None):
try:
tz = startdatetime.tzinfo
except AttributeError:
except AttributeError: # pragma: no cover
startdatetime = row.rowdatetime
partofday = getpartofday(row,r)
@@ -1899,7 +1899,7 @@ def get_startdate_time_zone(r,row,startdatetime=None):
starttime = startdatetime.strftime('%H:%M:%S')
if timezone_str == 'tzutc()':
timezone_str = 'UTC'
timezone_str = 'UTC' # pragma: no cover
return startdatetime,startdate,starttime,timezone_str,partofday

View File

@@ -192,6 +192,24 @@ def get_nk_summary(workoutdata,strokedata):
maxhr = strokedata['heartRate'].max()
pwr = workoutdata['avgPower']
if dist is None: # pragma: no cover
dist = 0
if spm is None: # pragma: no cover
spm = 0
if avghr is None: # pragma: no cover
avghr = 0
if avgdps is None: # pragma: no cover
avgdps = 0
if maxhr is None: # pragma: no cover
maxhr = 0
if pwr is None: # pragma: no cover
pwr = 0
sep = "|"

View File

@@ -327,7 +327,7 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
try:
act = client.upload_activity(f,'tcx.gz',name=name)
try:
res = act.wait(poll_interval=5.0, timeout=60)
res = act.wait(poll_interval=1.0, timeout=60)
except stravalib.exc.ActivityUploadFailed: # pragma: no cover
failed = True
except JSONDecodeError: # pragma: no cover
@@ -338,6 +338,7 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
failed = True
if not failed:
result = update_workout_field_sql(workoutid,'uploadedtostrava',res.id,debug=debug)
try:
act = client.update_activity(res.id,activity_type=activity_type,
description=description,device_name='Rowsandall.com')
@@ -353,7 +354,6 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
f.write(timestamp)
f.write(str(e))
result = update_workout_field_sql(workoutid,'uploadedtostrava',res.id,debug=debug)
try:
os.remove(filename)
except: # pragma: no cover

View File

@@ -547,7 +547,7 @@ def get_strava_stream(r,metric,stravaid,series_type='time',fetchresolution='high
return np.array(data['data'])
except TypeError: # pragma: no cover
return None
except:
except: # pragma: no cover
return None
return None # pragma: no cover