fix
This commit is contained in:
@@ -30,6 +30,18 @@ import pandas as pd
|
|||||||
from rowingdata import rowingdata as rrdata
|
from rowingdata import rowingdata as rrdata
|
||||||
from rowingdata import rower as rrower
|
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):
|
def to_time(milliseconds):
|
||||||
seconds = milliseconds/1000.
|
seconds = milliseconds/1000.
|
||||||
hours = int(seconds / 3600)
|
hours = int(seconds / 3600)
|
||||||
@@ -82,6 +94,7 @@ from rowers.utils import totaltime_sec_to_string
|
|||||||
|
|
||||||
def step_to_string(step):
|
def step_to_string(step):
|
||||||
|
|
||||||
|
print(step)
|
||||||
|
|
||||||
type = 'Step'
|
type = 'Step'
|
||||||
repeatID = -1
|
repeatID = -1
|
||||||
@@ -95,6 +108,8 @@ def step_to_string(step):
|
|||||||
repeat = ''
|
repeat = ''
|
||||||
|
|
||||||
durationtype = step['durationType']
|
durationtype = step['durationType']
|
||||||
|
if step['durationValue'] == 0:
|
||||||
|
return '',type, -1, -1
|
||||||
|
|
||||||
if durationtype == 'Time':
|
if durationtype == 'Time':
|
||||||
unit = 'min'
|
unit = 'min'
|
||||||
@@ -107,13 +122,13 @@ def step_to_string(step):
|
|||||||
duration = int(value)
|
duration = int(value)
|
||||||
elif durationtype == 'HrLessThan':
|
elif durationtype == 'HrLessThan':
|
||||||
value = step['durationValue']
|
value = step['durationValue']
|
||||||
if value < 100:
|
if value <= 100:
|
||||||
duration = 'until heart rate lower than {v}% of max'.format(v=value)
|
duration = 'until heart rate lower than {v}% of max'.format(v=value)
|
||||||
else:
|
else:
|
||||||
duration = 'until heart rate lower than {v}'.format(v=value-100)
|
duration = 'until heart rate lower than {v}'.format(v=value-100)
|
||||||
elif durationtype == 'HrGreaterThan':
|
elif durationtype == 'HrGreaterThan':
|
||||||
value = step['durationValue']
|
value = step['durationValue']
|
||||||
if value < 100:
|
if value <= 100:
|
||||||
duration = 'until heart rate greater than {v}% of max'.format(v=value)
|
duration = 'until heart rate greater than {v}% of max'.format(v=value)
|
||||||
else:
|
else:
|
||||||
duration = 'until heart rate greater than {v}'.format(v=value-100)
|
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:'
|
ntimes = str(step['targetValue'])+' times:'
|
||||||
repeatID = step['durationValue']
|
repeatID = step['durationValue']
|
||||||
duration =ntimes
|
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']
|
targettype = step['targetType']
|
||||||
|
|
||||||
@@ -166,7 +207,26 @@ def step_to_string(step):
|
|||||||
valuelow = step['targetValueLow']
|
valuelow = step['targetValueLow']
|
||||||
valuehigh = step['targetValueHigh']
|
valuehigh = step['targetValueHigh']
|
||||||
|
|
||||||
|
if value != 0:
|
||||||
|
v = value/1000.
|
||||||
|
pace = 500./v
|
||||||
|
print(to_pace(pace))
|
||||||
target = 'Target: Speed at {v} m/s'.format(v=value/1000.)
|
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']
|
nr = step['stepId']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user