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
|
||||
|
||||
def step_to_string(step):
|
||||
|
||||
print(step)
|
||||
|
||||
type = 'Step'
|
||||
repeatID = -1
|
||||
|
||||
@@ -132,6 +129,28 @@ def step_to_string(step):
|
||||
duration = 'until heart rate greater than {v}% of max'.format(v=value)
|
||||
else:
|
||||
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':
|
||||
type = 'RepeatStep'
|
||||
ntimes = str(step['targetValue'])+' times:'
|
||||
@@ -162,6 +181,7 @@ def step_to_string(step):
|
||||
)
|
||||
repeatID = step['durationValue']
|
||||
|
||||
|
||||
#
|
||||
|
||||
targettype = step['targetType']
|
||||
@@ -210,7 +230,6 @@ def step_to_string(step):
|
||||
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.
|
||||
@@ -227,6 +246,19 @@ def step_to_string(step):
|
||||
pl = pacestringlow,
|
||||
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']
|
||||
|
||||
|
||||
@@ -1912,8 +1912,11 @@ def plannedsession_view(request,id=0,userid=0):
|
||||
r = getrequestplanrower(request,userid=userid)
|
||||
|
||||
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:
|
||||
r = VirtualRace.objects.get(id=ps.id)
|
||||
|
||||
Reference in New Issue
Block a user