first implementation
This commit is contained in:
@@ -306,8 +306,29 @@ class IntervalsIntegration(SyncIntegration):
|
||||
w.workouttype = mytypes.intervalsmappinginv[data['type']]
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
w.rpe = data['icu_rpe']
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
w.is_commute = data['commute']
|
||||
if w.is_commute is None:
|
||||
w.is_commute = False
|
||||
except KeyError:
|
||||
w.is_commute = False
|
||||
|
||||
w.save()
|
||||
|
||||
try:
|
||||
paired_session_icu_id = data['paired_event_id']
|
||||
pss = PlannedSession.objects.filter(intervals_icu_id=paired_session_icu_id, rower=self.rower)
|
||||
if pss.count() > 0:
|
||||
for ps in pss:
|
||||
w.plannedsession = ps
|
||||
w.save()
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
# we stop here now
|
||||
return 1
|
||||
|
||||
@@ -406,6 +427,18 @@ class IntervalsIntegration(SyncIntegration):
|
||||
except KeyError:
|
||||
title = 'Intervals workout'
|
||||
|
||||
try:
|
||||
rpe = data['icu_rpe']
|
||||
except KeyError:
|
||||
rpe = 0
|
||||
|
||||
try:
|
||||
is_commute = data['commute']
|
||||
if is_commute is None:
|
||||
is_commute = False
|
||||
except KeyError:
|
||||
is_commute = False
|
||||
|
||||
try:
|
||||
workouttype = mytypes.intervalsmappinginv[data['type']]
|
||||
except KeyError:
|
||||
@@ -443,13 +476,38 @@ class IntervalsIntegration(SyncIntegration):
|
||||
'file': fit_filename,
|
||||
'intervalsid': id,
|
||||
'title': title,
|
||||
'rpe': 0,
|
||||
'rpe': rpe,
|
||||
'notes': '',
|
||||
'offline': False,
|
||||
}
|
||||
|
||||
url = UPLOAD_SERVICE_URL
|
||||
return handle_request_post(url, uploadoptions)
|
||||
handle_request_post(url, uploadoptions)
|
||||
|
||||
try:
|
||||
pair_id = data['paired_event_id']
|
||||
pss = PlannedSession.objects.filter(intervals_icu_id=pair_id, rower=r)
|
||||
ws = Workout.objects.filter(uploadedtointervals=id)
|
||||
if is_commute:
|
||||
for w in ws:
|
||||
w.is_commute = True
|
||||
w.save()
|
||||
if pss.count() > 0:
|
||||
for ps in pss:
|
||||
for w in ws:
|
||||
w.plannedsession = ps
|
||||
w.save()
|
||||
except KeyError:
|
||||
pass
|
||||
except PlannedSession.DoesNotExist:
|
||||
pass
|
||||
except Workout.DoesNotExist:
|
||||
pass
|
||||
|
||||
return 1
|
||||
|
||||
def pair_workout_and_session(w, id):
|
||||
pass
|
||||
|
||||
|
||||
def get_workouts(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user