From 43a2e13e356c9e341f3becac52c8e3eab72edd13 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 18 Feb 2025 16:32:20 +0100 Subject: [PATCH 1/4] commute and race override warmup and cooldown --- rowers/views/workoutviews.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index b23fa352..b69629f8 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -4537,9 +4537,9 @@ def workout_edit_view(request, id=0, message="", successmessage=""): boatname = form.cleaned_data.get('boatname', '') empowerside = form.cleaned_data.get('empowerside','port') - if is_race and subtype is None: + if is_race: subtype = "Race" - elif is_commute and subtype is None: + elif is_commute: subtype = "Commute" if private: From 9767cc3bd37ce1ee41544f6a2bd6bbc499a5a3fc Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 18 Feb 2025 17:47:56 +0100 Subject: [PATCH 2/4] some more wup and cd stuff --- rowers/integrations/intervals.py | 22 ++++++++++++++++++++++ rowers/tasks.py | 11 ++++++----- rowers/tests/testdata/testdata.tcx.gz | Bin 3989 -> 3989 bytes 3 files changed, 28 insertions(+), 5 deletions(-) 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 c4e640aa2b31a89ff00681cf8b6d1042d5962c15..fb37b5a5927bb55dc5404aa4742d00640ad96ce7 100644 GIT binary patch delta 15 WcmbO#KUJPhzMF%?V)aJ0etrNV{sdtF delta 15 WcmbO#KUJPhzMF$1V(Lb=etrNWPy}lL From afb207463bcf21332bcf13e5e4bd4930bbcecc7b Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 21 Feb 2025 17:11:05 +0100 Subject: [PATCH 3/4] extra logging on intervals.icu --- rowers/integrations/intervals.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rowers/integrations/intervals.py b/rowers/integrations/intervals.py index ada7b5c9..8d65d39c 100644 --- a/rowers/integrations/intervals.py +++ b/rowers/integrations/intervals.py @@ -123,6 +123,7 @@ class IntervalsIntegration(SyncIntegration): try: row = rowingdata(csvfile=filename) except IOError: # pragma: no cover + dologging('intervals.icu.log', "Could not open file {filename}".format(filename=filename)) data = dataprep.read_df_sql(w.id) try: datalength = len(data) @@ -136,8 +137,10 @@ class IntervalsIntegration(SyncIntegration): try: row = rowingdata(csvfile=filename) except IOError: # pragma: no cover + dologging('intervals.icu.log', "Could not open file {filename}".format(filename=filename)) return '' # pragma: no cover else: + dologging('intervals.icu.log', "Could not create data for workout {id}".format(id=w.id)) return '' tcxfilename = w.csvfilename[:-4] + '.tcx' @@ -146,7 +149,7 @@ class IntervalsIntegration(SyncIntegration): except TypeError: newnotes = 'from'+w.workoutsource+' via rowsandall.com' - if w.user.intervals_resample_to_1s and w_resampled: + if w_resampled: w_resampled.delete() row.exporttotcx(tcxfilename, notes=newnotes, sport=mytypes.intervalsmapping[w.workouttype]) if dozip: @@ -161,6 +164,7 @@ class IntervalsIntegration(SyncIntegration): except WindowsError: # pragma: no cover pass except FileNotFoundError: + dologging('intervals.icu.log', "Could not open file {filename}".format(filename=tcxfilename)) return '' return gzfilename @@ -177,6 +181,7 @@ class IntervalsIntegration(SyncIntegration): filename = self.createworkoutdata(workout) if not filename: + dologging('intervals.icu.log', "Could not create data for workout {id}".format(id=workout.id)) return 0 params = { @@ -227,6 +232,7 @@ class IntervalsIntegration(SyncIntegration): response = requests.put(url, headers=headers, json=jsondict) if response.status_code not in [200, 201]: + dologging('intervals.icu.log', response.reason) return 0 From 66818d41aac5a67d6884c30c58f305e735ae71bf Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 21 Feb 2025 17:25:43 +0100 Subject: [PATCH 4/4] some extra logging for intervals.icu export --- rowers/tests/testdata/testdata.tcx.gz | Bin 3989 -> 3989 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index fb37b5a5927bb55dc5404aa4742d00640ad96ce7..0a2677c44eab2605dd5a954506bc44eadd3f65d9 100644 GIT binary patch delta 16 XcmbO#KUJPxzMF$XZP|{E?0x(IDH8<) delta 16 XcmbO#KUJPxzMF%?V)d4d?0x(IDVqfr