diff --git a/rowers/integrations/intervals.py b/rowers/integrations/intervals.py index 4e0ac680..1cdcbfb0 100644 --- a/rowers/integrations/intervals.py +++ b/rowers/integrations/intervals.py @@ -101,7 +101,16 @@ class IntervalsIntegration(SyncIntegration): def createworkoutdata(self, w, *args, **kwargs) -> str: dozip = kwargs.get('dozip', True) - filename = w.csvfilename + # resample if wanted by user, not tested + if w.user.intervals_resample_to_1s: + datadf, id, msgs = dataprep.resample( + w.id, w.user, w, overwrite=False + ) + w_resampled = Workout.objects.get(id=id) + filename = w_resampled.csvfilename + else: + w_resampled = None + filename = w.csvfilename try: row = rowingdata(csvfile=filename) except IOError: # pragma: no cover @@ -128,6 +137,8 @@ class IntervalsIntegration(SyncIntegration): except TypeError: newnotes = 'from'+w.workoutsource+' via rowsandall.com' + if w.user.intervals_resample_to_1s and w_resampled: + w_resampled.delete() row.exporttotcx(tcxfilename, notes=newnotes, sport=mytypes.intervalsmapping[w.workouttype]) if dozip: gzfilename = tcxfilename + '.gz' diff --git a/rowers/models.py b/rowers/models.py index 3ac826ff..cd2500f7 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -1174,6 +1174,7 @@ class Rower(models.Model): c2_auto_import = models.BooleanField(default=False) intervals_auto_export = models.BooleanField(default=False) intervals_auto_import = models.BooleanField(default=False) + intervals_resample_to_1s = models.BooleanField(default=False, verbose_name='Resample to 1s on export') sporttrackstoken = models.CharField( default='', max_length=200, blank=True, null=True) sporttrackstokenexpirydate = models.DateTimeField(blank=True, null=True) @@ -4578,6 +4579,7 @@ class RowerExportFormIntervals(ModelForm): fields = [ 'intervals_auto_import', 'intervals_auto_export', + 'intervals_resample_to_1s', ] class RowerExportFormGarmin(ModelForm): diff --git a/rowers/templates/rower_exportsettings.html b/rowers/templates/rower_exportsettings.html index 9625a472..0d7d3858 100644 --- a/rowers/templates/rower_exportsettings.html +++ b/rowers/templates/rower_exportsettings.html @@ -64,13 +64,13 @@ {% endif %}