diff --git a/rowers/integrations/intervals.py b/rowers/integrations/intervals.py index 15a019f6..ada7b5c9 100644 --- a/rowers/integrations/intervals.py +++ b/rowers/integrations/intervals.py @@ -471,6 +471,20 @@ class IntervalsIntegration(SyncIntegration): except KeyError: is_commute = False + try: + is_race = data['race'] + if is_race is None: + is_race = False + except KeyError: + is_race = False + + try: + subtype = data['sub_type'] + if subtype is not None: + subtype = subtype.capitalize() + except KeyError: + subtype = None + try: workouttype = mytypes.intervalsmappinginv[data['type']] except KeyError: @@ -520,9 +534,17 @@ class IntervalsIntegration(SyncIntegration): pair_id = data['paired_event_id'] pss = PlannedSession.objects.filter(intervals_icu_id=pair_id, rower=r) ws = Workout.objects.filter(uploadedtointervals=id) + for w in ws: + w.sub_type = subtype + w.save() if is_commute: for w in ws: w.is_commute = True + w.sub_type = "Commute" + w.save() + if is_race: + for w in ws: + w.is_race = True w.save() if pss.count() > 0: for ps in pss: diff --git a/rowers/tasks.py b/rowers/tasks.py index d2ddb567..6013a191 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -3680,17 +3680,18 @@ def handle_intervals_getworkout(rower, intervalstoken, workoutid, debug=False, * try: paired_event_id = data['paired_event_id'] ws = Workout.objects.filter(uploadedtointervals=workoutid) + for w in ws: + w.sub_type = subtype + w.save() if is_commute: for w in ws: w.is_commute = True w.sub_type = "Commute" w.save() - for w in ws: - w.sub_type = subtype - w.save() if is_race: - w.is_race = True - w.save() + for w in ws: + w.is_race = True + w.save() if ws.count() > 0: pss = PlannedSession.objects.filter(rower=rower,intervals_icu_id=paired_event_id) if pss.count() > 0: diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index c4e640aa..fb37b5a5 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ