Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2021-05-04 08:50:52 +02:00
parent 6f615c4ccc
commit 652d972411
4 changed files with 15 additions and 26 deletions

View File

@@ -589,18 +589,15 @@ def step_to_time_dist(step,avgspeed = 3.2,ftp=200,ftspm=25,ftv=3.7):
seconds = 0
distance = 0
rscore = 0
durationtype = step['durationType']
durationtype = step.get('durationType',0)
value = step.get('durationValue',0)
if step['durationValue'] == 0: # pragma: no cover
if value == 0: # pragma: no cover
return 0,0,0
try:
targettype = step['targetType']
except KeyError: # pragma: no cover
targettype = 0
targettype = step.get('targetType',0)
if durationtype == 'Time':
value = step['durationValue']
seconds = value/1000.
distance = avgspeed*seconds
rscore = 60.*seconds/3600.
@@ -616,6 +613,8 @@ def step_to_time_dist(step,avgspeed = 3.2,ftp=200,ftspm=25,ftv=3.7):
elif valuelow != 0 and valuehigh != 0: # pragma: no cover
distance = seconds*(valuelow+valuehigh)/2.
velomid = (valuelow+valuehigh)/2000.
else:
velomid = avgspeed
veloratio = (velomid/ftv)**(3.0)
rscoreperhour = 100.*veloratio
@@ -657,11 +656,10 @@ def step_to_time_dist(step,avgspeed = 3.2,ftp=200,ftspm=25,ftv=3.7):
rscore = 100*(avgpower/ftp)*seconds/3600.
return seconds,distance,rscore
elif durationtype == 'Distance': # pragma: no cover
value = step['durationValue']
elif durationtype == 'Distance':
distance = value/100.
seconds = distance/avgspeed
rscore = 60*seconds/3600.
rscore = 60.*float(seconds)/3600.
if targettype == 'Speed':
value = step.get('targetValue',0)