fix
This commit is contained in:
@@ -30,6 +30,18 @@ import pandas as pd
|
||||
from rowingdata import rowingdata as rrdata
|
||||
from rowingdata import rower as rrower
|
||||
|
||||
def to_pace(pace):
|
||||
minutes, seconds = divmod(pace,60)
|
||||
seconds, rest = divmod(seconds, 1)
|
||||
tenths = int(rest*10)
|
||||
s = '{m:0>2}:{s:0>2}.{t:0>1}'.format(
|
||||
m=int(minutes),
|
||||
s=int(seconds),
|
||||
t=int(tenths)
|
||||
)
|
||||
return s
|
||||
|
||||
|
||||
def to_time(milliseconds):
|
||||
seconds = milliseconds/1000.
|
||||
hours = int(seconds / 3600)
|
||||
@@ -82,6 +94,7 @@ from rowers.utils import totaltime_sec_to_string
|
||||
|
||||
def step_to_string(step):
|
||||
|
||||
print(step)
|
||||
|
||||
type = 'Step'
|
||||
repeatID = -1
|
||||
@@ -95,6 +108,8 @@ def step_to_string(step):
|
||||
repeat = ''
|
||||
|
||||
durationtype = step['durationType']
|
||||
if step['durationValue'] == 0:
|
||||
return '',type, -1, -1
|
||||
|
||||
if durationtype == 'Time':
|
||||
unit = 'min'
|
||||
@@ -107,13 +122,13 @@ def step_to_string(step):
|
||||
duration = int(value)
|
||||
elif durationtype == 'HrLessThan':
|
||||
value = step['durationValue']
|
||||
if value < 100:
|
||||
if value <= 100:
|
||||
duration = 'until heart rate lower than {v}% of max'.format(v=value)
|
||||
else:
|
||||
duration = 'until heart rate lower than {v}'.format(v=value-100)
|
||||
elif durationtype == 'HrGreaterThan':
|
||||
value = step['durationValue']
|
||||
if value < 100:
|
||||
if value <= 100:
|
||||
duration = 'until heart rate greater than {v}% of max'.format(v=value)
|
||||
else:
|
||||
duration = 'until heart rate greater than {v}'.format(v=value-100)
|
||||
@@ -122,6 +137,32 @@ def step_to_string(step):
|
||||
ntimes = str(step['targetValue'])+' times:'
|
||||
repeatID = step['durationValue']
|
||||
duration =ntimes
|
||||
elif durationtype == 'RepeatUntilHrGreaterThan':
|
||||
type = 'RepeatStep'
|
||||
targetvalue = step['targetValue']
|
||||
if targetvalue <= 100:
|
||||
duration = 'Repeat until Heart Rate is greater than {targetvalue} % of max'.format(
|
||||
targetvalue=targetvalue
|
||||
)
|
||||
else:
|
||||
duration = 'Repeat until Heart Rate is greater than {targetvalue}:'.format(
|
||||
targetvalue=targetvalue-100.
|
||||
)
|
||||
repeatID = step['durationValue']
|
||||
elif durationtype == 'RepeatUntilHrLessThan':
|
||||
type = 'RepeatStep'
|
||||
targetvalue = step['targetValue']
|
||||
if targetvalue <= 100:
|
||||
duration = 'Repeat until Heart Rate is less than {targetvalue} % of max'.format(
|
||||
targetvalue=targetvalue
|
||||
)
|
||||
else:
|
||||
duration = 'Repeat until Heart Rate is less than {targetvalue}:'.format(
|
||||
targetvalue=targetvalue-100.
|
||||
)
|
||||
repeatID = step['durationValue']
|
||||
|
||||
#
|
||||
|
||||
targettype = step['targetType']
|
||||
|
||||
@@ -166,7 +207,26 @@ def step_to_string(step):
|
||||
valuelow = step['targetValueLow']
|
||||
valuehigh = step['targetValueHigh']
|
||||
|
||||
target = 'Target: Speed at {v} m/s'.format(v=value/1000.)
|
||||
if value != 0:
|
||||
v = value/1000.
|
||||
pace = 500./v
|
||||
print(to_pace(pace))
|
||||
target = 'Target: Speed at {v} m/s'.format(v=value/1000.)
|
||||
elif valuelow != 0 and valuehigh != 0:
|
||||
v = valuelow/1000.
|
||||
pace = 500./v
|
||||
pacestringlow = to_pace(pace)
|
||||
|
||||
v = valuehigh/1000.
|
||||
pace = 500./v
|
||||
pacestringhigh = to_pace(pace)
|
||||
|
||||
target = 'Target: Speed between {l:1.2f} and {h:1.2f} m/s ({ph} to {pl} per 500m)'.format(
|
||||
l = valuelow/1000.,
|
||||
h = valuehigh/1000.,
|
||||
pl = pacestringlow,
|
||||
ph = pacestringhigh,
|
||||
)
|
||||
|
||||
nr = step['stepId']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user