Private
Public Access
1
0

fixed repeatUntilStepsCmplt

This commit is contained in:
2025-04-14 20:55:45 +02:00
parent 8175e8f954
commit ec4822be39
3 changed files with 15 additions and 0 deletions

View File

@@ -1067,6 +1067,14 @@ def get_workouts_session(r, ps):
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):
# reads the steps and if the intensity is an integer, converts it to a string
steps = workout['steps']
@@ -1074,6 +1082,9 @@ def correct_intensity(workout):
if 'intensity' in step:
if isinstance(step['intensity'], int):
step['intensity'] = intensitymap[step['intensity']]
step['durationType'] = strcapitalize(step['durationType'])
step['targetType'] = strcapitalize(step['targetType'])
step['intensity'] = strcapitalize(step['intensity'])
return workout

Binary file not shown.

View File

@@ -749,12 +749,16 @@ def steps_write_fit(steps):
headers = {'Authorization': authorizationstring}
# convert to json, value of keys called wkt_step_name to string
newsteps = []
for step in steps['steps']:
step['wkt_step_name'] = str(step['wkt_step_name'])
# convert numerical values in the dict to integers
for key in step.keys():
if isinstance(step[key], (int, float)):
step[key] = int(step[key])
newsteps.append(step)
steps['steps'] = newsteps
response = requests.post(url=url, headers=headers, json=steps)