added PowerLessThan and PowerGreaterThan
This commit is contained in:
@@ -93,9 +93,6 @@ from rowers.tasks import (
|
|||||||
from rowers.utils import totaltime_sec_to_string
|
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
|
||||||
|
|
||||||
@@ -132,6 +129,28 @@ def step_to_string(step):
|
|||||||
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)
|
||||||
|
elif durationtype == 'PowerLessThan':
|
||||||
|
value = step['durationValue']
|
||||||
|
targetvalue = step['targetvalue']
|
||||||
|
if value <= 1000:
|
||||||
|
duration = 'Repeat until Power is less than {targetvalue} % of FTP'.format(
|
||||||
|
targetvalue=targetvalue
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
duration = 'Repeat until Power is less than {targetvalue} Watt'.format(
|
||||||
|
targetvalue=targetvalie
|
||||||
|
)
|
||||||
|
elif durationtype == 'PowerGreaterThan':
|
||||||
|
value = step['durationValue']
|
||||||
|
targetvalue = step['targetvalue']
|
||||||
|
if value <= 1000:
|
||||||
|
duration = 'Repeat until Power is greater than {targetvalue} % of FTP'.format(
|
||||||
|
targetvalue=targetvalue
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
duration = 'Repeat until Power is greater than {targetvalue} Watt'.format(
|
||||||
|
targetvalue=targetvalie
|
||||||
|
)
|
||||||
elif durationtype == 'RepeatUntilStepsCmplt':
|
elif durationtype == 'RepeatUntilStepsCmplt':
|
||||||
type = 'RepeatStep'
|
type = 'RepeatStep'
|
||||||
ntimes = str(step['targetValue'])+' times:'
|
ntimes = str(step['targetValue'])+' times:'
|
||||||
@@ -162,6 +181,7 @@ def step_to_string(step):
|
|||||||
)
|
)
|
||||||
repeatID = step['durationValue']
|
repeatID = step['durationValue']
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
targettype = step['targetType']
|
targettype = step['targetType']
|
||||||
@@ -210,7 +230,6 @@ def step_to_string(step):
|
|||||||
if value != 0:
|
if value != 0:
|
||||||
v = value/1000.
|
v = value/1000.
|
||||||
pace = 500./v
|
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:
|
elif valuelow != 0 and valuehigh != 0:
|
||||||
v = valuelow/1000.
|
v = valuelow/1000.
|
||||||
@@ -227,6 +246,19 @@ def step_to_string(step):
|
|||||||
pl = pacestringlow,
|
pl = pacestringlow,
|
||||||
ph = pacestringhigh,
|
ph = pacestringhigh,
|
||||||
)
|
)
|
||||||
|
elif targettype == 'Cadence':
|
||||||
|
value = step['targetValue']
|
||||||
|
valuelow = step['targetValueLow']
|
||||||
|
valuehigh = step['targetValueHigh']
|
||||||
|
|
||||||
|
if value != 0:
|
||||||
|
target = 'Target: Cadence at {v} SPM'.format(v=value)
|
||||||
|
elif valuelow != 0 and valuehigh != 0:
|
||||||
|
target = 'Target: Cadence between {l} and {h} SPM'.format(
|
||||||
|
l = valuelow/1000.,
|
||||||
|
h = valuehigh/1000.,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
nr = step['stepId']
|
nr = step['stepId']
|
||||||
|
|
||||||
|
|||||||
@@ -1912,7 +1912,10 @@ def plannedsession_view(request,id=0,userid=0):
|
|||||||
r = getrequestplanrower(request,userid=userid)
|
r = getrequestplanrower(request,userid=userid)
|
||||||
|
|
||||||
ps = get_object_or_404(PlannedSession,pk=id)
|
ps = get_object_or_404(PlannedSession,pk=id)
|
||||||
jsons = json.loads(ps.steps_json)
|
if ps.steps_json is not None:
|
||||||
|
jsons = json.loads(ps.steps_json)
|
||||||
|
else:
|
||||||
|
jsons = {}
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user