Private
Public Access
1
0

warmingup/cd

This commit is contained in:
2025-02-16 19:13:19 +01:00
parent 1c12ebb162
commit 8121b77ba7
5 changed files with 62 additions and 6 deletions

View File

@@ -203,20 +203,32 @@ class IntervalsIntegration(SyncIntegration):
return 0
id = response.json()['id']
workout.uploadedtointervals = id
workout.save()
os.remove(filename)
# set workout type to workouttype
url = "https://intervals.icu/api/v1/activity/{activityid}".format(activityid=id)
thetype = mytypes.intervalsmapping[workout.workouttype]
response = requests.put(url, headers=headers, json={'type': thetype})
jsondict = {'type': thetype}
subtype = w.sub_type
if subtype:
jsondict['sub_type'] = subtype
jsondict['icu_rpe'] = workout.rpe
jsondict['commute'] = workout.is_commute
if workout.plannedsession:
jsondict['paired_event_id'] = workout.plannedsession.intervals_icu_id
response = requests.put(url, headers=headers, json=jsondict)
if response.status_code not in [200, 201]:
return 0
workout.uploadedtointervals = id
workout.save()
os.remove(filename)
dologging('intervals.icu.log', "Exported workout {id}".format(id=workout.id))