diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 28da7b70..48bfe281 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -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 diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index 5c76f9ad..459a6f00 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ diff --git a/rowers/utils.py b/rowers/utils.py index 5b8a0500..743df665 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -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)