Private
Public Access
1
0

adding resampling on demand, untested

This commit is contained in:
2024-12-13 13:15:48 +01:00
parent ab33759bd2
commit a7d48d711f
4 changed files with 27 additions and 14 deletions

View File

@@ -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'

View File

@@ -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):

View File

@@ -64,13 +64,13 @@
</li>
{% endif %}
<li class="rounder">
<h2>Polar</h2>
<h2>Intervals.icu</h2>
<table>
{{ forms.polar.as_table }}
{{ forms.intervals.as_table }}
<input type="submit" value="Save">
</table>
<p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png"
alt="connect with Polar" width="130"></a></p>
<p><a href="/rowers/me/intervalsauthorize"><img src="/static/img/intervals_icu.png"
alt="connect with intervals.icu"></a></p>
</li>
<li class="rounder">
<h2>Concept2</h2>
@@ -103,20 +103,20 @@
<input type="submit" value="Save">
</table>
</li>
<li class="rounder">
<h2>Polar</h2>
<table>
{{ forms.polar.as_table }}
<input type="submit" value="Save">
</table>
<p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png"
alt="connect with Polar" width="130"></a></p>
</li>
<li class="rounder">
<h2>Rojabo</h2>
<p><a href="/rowers/me/rojaboauthorize"><img src="/static/img/rojabo.png"
alt="connect with Rojabo" width="130"></a></p>
</li>
<li class="rounder">
<h2>Intervals.icu</h2>
<table>
{{ forms.intervals.as_table }}
<input type="submit" value="Save">
</table>
<p><a href="/rowers/me/intervalsauthorize"><img src="/static/img/intervals_icu.png"
alt="connect with intervals.icu"></a></p>
</li>
<li class="rounder">
<h2>Garmin Connect</h2>
<table>

Binary file not shown.