adding resampling on demand, untested
This commit is contained in:
@@ -101,6 +101,15 @@ class IntervalsIntegration(SyncIntegration):
|
|||||||
|
|
||||||
def createworkoutdata(self, w, *args, **kwargs) -> str:
|
def createworkoutdata(self, w, *args, **kwargs) -> str:
|
||||||
dozip = kwargs.get('dozip', True)
|
dozip = kwargs.get('dozip', True)
|
||||||
|
# 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
|
filename = w.csvfilename
|
||||||
try:
|
try:
|
||||||
row = rowingdata(csvfile=filename)
|
row = rowingdata(csvfile=filename)
|
||||||
@@ -128,6 +137,8 @@ class IntervalsIntegration(SyncIntegration):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
newnotes = 'from'+w.workoutsource+' via rowsandall.com'
|
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])
|
row.exporttotcx(tcxfilename, notes=newnotes, sport=mytypes.intervalsmapping[w.workouttype])
|
||||||
if dozip:
|
if dozip:
|
||||||
gzfilename = tcxfilename + '.gz'
|
gzfilename = tcxfilename + '.gz'
|
||||||
|
|||||||
@@ -1174,6 +1174,7 @@ class Rower(models.Model):
|
|||||||
c2_auto_import = models.BooleanField(default=False)
|
c2_auto_import = models.BooleanField(default=False)
|
||||||
intervals_auto_export = models.BooleanField(default=False)
|
intervals_auto_export = models.BooleanField(default=False)
|
||||||
intervals_auto_import = 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(
|
sporttrackstoken = models.CharField(
|
||||||
default='', max_length=200, blank=True, null=True)
|
default='', max_length=200, blank=True, null=True)
|
||||||
sporttrackstokenexpirydate = models.DateTimeField(blank=True, null=True)
|
sporttrackstokenexpirydate = models.DateTimeField(blank=True, null=True)
|
||||||
@@ -4578,6 +4579,7 @@ class RowerExportFormIntervals(ModelForm):
|
|||||||
fields = [
|
fields = [
|
||||||
'intervals_auto_import',
|
'intervals_auto_import',
|
||||||
'intervals_auto_export',
|
'intervals_auto_export',
|
||||||
|
'intervals_resample_to_1s',
|
||||||
]
|
]
|
||||||
|
|
||||||
class RowerExportFormGarmin(ModelForm):
|
class RowerExportFormGarmin(ModelForm):
|
||||||
|
|||||||
@@ -64,13 +64,13 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Polar</h2>
|
<h2>Intervals.icu</h2>
|
||||||
<table>
|
<table>
|
||||||
{{ forms.polar.as_table }}
|
{{ forms.intervals.as_table }}
|
||||||
<input type="submit" value="Save">
|
<input type="submit" value="Save">
|
||||||
</table>
|
</table>
|
||||||
<p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png"
|
<p><a href="/rowers/me/intervalsauthorize"><img src="/static/img/intervals_icu.png"
|
||||||
alt="connect with Polar" width="130"></a></p>
|
alt="connect with intervals.icu"></a></p>
|
||||||
</li>
|
</li>
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Concept2</h2>
|
<h2>Concept2</h2>
|
||||||
@@ -103,20 +103,20 @@
|
|||||||
<input type="submit" value="Save">
|
<input type="submit" value="Save">
|
||||||
</table>
|
</table>
|
||||||
</li>
|
</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">
|
<li class="rounder">
|
||||||
<h2>Rojabo</h2>
|
<h2>Rojabo</h2>
|
||||||
<p><a href="/rowers/me/rojaboauthorize"><img src="/static/img/rojabo.png"
|
<p><a href="/rowers/me/rojaboauthorize"><img src="/static/img/rojabo.png"
|
||||||
alt="connect with Rojabo" width="130"></a></p>
|
alt="connect with Rojabo" width="130"></a></p>
|
||||||
</li>
|
</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">
|
<li class="rounder">
|
||||||
<h2>Garmin Connect</h2>
|
<h2>Garmin Connect</h2>
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user