fixed repeatUntilStepsCmplt
This commit is contained in:
@@ -1067,6 +1067,14 @@ def get_workouts_session(r, ps):
|
|||||||
|
|
||||||
return ws
|
return ws
|
||||||
|
|
||||||
|
def strcapitalize(s):
|
||||||
|
if s is None:
|
||||||
|
return None
|
||||||
|
if isinstance(s, str):
|
||||||
|
return s[0].upper() + s[1:]
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
def correct_intensity(workout):
|
def correct_intensity(workout):
|
||||||
# reads the steps and if the intensity is an integer, converts it to a string
|
# reads the steps and if the intensity is an integer, converts it to a string
|
||||||
steps = workout['steps']
|
steps = workout['steps']
|
||||||
@@ -1074,6 +1082,9 @@ def correct_intensity(workout):
|
|||||||
if 'intensity' in step:
|
if 'intensity' in step:
|
||||||
if isinstance(step['intensity'], int):
|
if isinstance(step['intensity'], int):
|
||||||
step['intensity'] = intensitymap[step['intensity']]
|
step['intensity'] = intensitymap[step['intensity']]
|
||||||
|
step['durationType'] = strcapitalize(step['durationType'])
|
||||||
|
step['targetType'] = strcapitalize(step['targetType'])
|
||||||
|
step['intensity'] = strcapitalize(step['intensity'])
|
||||||
|
|
||||||
return workout
|
return workout
|
||||||
|
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -749,12 +749,16 @@ def steps_write_fit(steps):
|
|||||||
headers = {'Authorization': authorizationstring}
|
headers = {'Authorization': authorizationstring}
|
||||||
|
|
||||||
# convert to json, value of keys called wkt_step_name to string
|
# convert to json, value of keys called wkt_step_name to string
|
||||||
|
newsteps = []
|
||||||
for step in steps['steps']:
|
for step in steps['steps']:
|
||||||
step['wkt_step_name'] = str(step['wkt_step_name'])
|
step['wkt_step_name'] = str(step['wkt_step_name'])
|
||||||
# convert numerical values in the dict to integers
|
# convert numerical values in the dict to integers
|
||||||
for key in step.keys():
|
for key in step.keys():
|
||||||
if isinstance(step[key], (int, float)):
|
if isinstance(step[key], (int, float)):
|
||||||
step[key] = int(step[key])
|
step[key] = int(step[key])
|
||||||
|
newsteps.append(step)
|
||||||
|
|
||||||
|
steps['steps'] = newsteps
|
||||||
|
|
||||||
response = requests.post(url=url, headers=headers, json=steps)
|
response = requests.post(url=url, headers=headers, json=steps)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user