Merge branch 'feature/icu_settings' into develop
This commit is contained in:
+2
-2
@@ -369,7 +369,7 @@ def workout_summary_to_df(
|
|||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
def resample(id, r, parent, overwrite='copy'):
|
def resample(id, r, parent, overwrite=False):
|
||||||
data, row = getrowdata_db(id=id)
|
data, row = getrowdata_db(id=id)
|
||||||
messages = []
|
messages = []
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ def resample(id, r, parent, overwrite='copy'):
|
|||||||
data['pace'] = data['pace'] / 1000.
|
data['pace'] = data['pace'] / 1000.
|
||||||
data['time'] = data['time'] / 1000.
|
data['time'] = data['time'] / 1000.
|
||||||
|
|
||||||
if overwrite == 'overwrite':
|
if overwrite == True:
|
||||||
# remove CP data
|
# remove CP data
|
||||||
try:
|
try:
|
||||||
cpfile = 'media/cpdata_{id}.parquet.gz'.format(id=parent.id)
|
cpfile = 'media/cpdata_{id}.parquet.gz'.format(id=parent.id)
|
||||||
|
|||||||
+14
-6
@@ -67,13 +67,12 @@ class FlexibleDecimalField(forms.DecimalField):
|
|||||||
|
|
||||||
|
|
||||||
class ResampleForm(forms.Form):
|
class ResampleForm(forms.Form):
|
||||||
resamplechoices = (
|
# add resamplechoice field, the result is a True or False boolean, labels are "overwrite" and "create copy"
|
||||||
('overwrite', 'Overwrite Workout'),
|
|
||||||
('copy', 'Create a Duplicate Workout')
|
|
||||||
)
|
|
||||||
|
|
||||||
resamplechoice = forms.ChoiceField(
|
resamplechoice = forms.ChoiceField(
|
||||||
initial='copy', choices=resamplechoices, label='Copy behavior')
|
required=True,
|
||||||
|
choices=((True, 'overwrite'), (False, 'create copy')),
|
||||||
|
label='Resample choice',
|
||||||
|
widget=forms.RadioSelect)
|
||||||
|
|
||||||
|
|
||||||
class TrainingZonesForm(forms.Form):
|
class TrainingZonesForm(forms.Form):
|
||||||
@@ -582,6 +581,11 @@ class UploadOptionsForm(forms.Form):
|
|||||||
races = VirtualRace.objects.filter(
|
races = VirtualRace.objects.filter(
|
||||||
registration_closure__gt=timezone.now())
|
registration_closure__gt=timezone.now())
|
||||||
|
|
||||||
|
# set upload_to_X based on r.X_auto_export
|
||||||
|
for field in ['C2', 'Strava', 'SportTracks', 'TrainingPeaks', 'Intervals']:
|
||||||
|
if getattr(r, field.lower()+'_auto_export') and r.rowerplan in ['pro', 'plan','coach']:
|
||||||
|
self.fields['upload_to_'+field].initial = True
|
||||||
|
|
||||||
registrations = IndoorVirtualRaceResult.objects.filter(
|
registrations = IndoorVirtualRaceResult.objects.filter(
|
||||||
race__in=races,
|
race__in=races,
|
||||||
userid=r.id)
|
userid=r.id)
|
||||||
@@ -665,6 +669,10 @@ class TeamUploadOptionsForm(forms.Form):
|
|||||||
upload_to_TrainingPeaks = forms.BooleanField(initial=False,
|
upload_to_TrainingPeaks = forms.BooleanField(initial=False,
|
||||||
required=False,
|
required=False,
|
||||||
label='Export to TrainingPeaks')
|
label='Export to TrainingPeaks')
|
||||||
|
|
||||||
|
upload_to_Intervals = forms.BooleanField(initial=False,
|
||||||
|
required=False,
|
||||||
|
label='Export to TrainingPeaks')
|
||||||
# do_physics = forms.BooleanField(initial=False,required=False,label='Power Estimate (OTW)')
|
# do_physics = forms.BooleanField(initial=False,required=False,label='Power Estimate (OTW)')
|
||||||
makeprivate = forms.BooleanField(initial=False, required=False,
|
makeprivate = forms.BooleanField(initial=False, required=False,
|
||||||
label='Make Workout Private')
|
label='Make Workout Private')
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import os
|
|||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
import rowers.dataprep as dataprep
|
||||||
|
|
||||||
from rowsandall_app.settings import (
|
from rowsandall_app.settings import (
|
||||||
INTERVALS_CLIENT_ID, INTERVALS_REDIRECT_URI, INTERVALS_CLIENT_SECRET, SITE_URL
|
INTERVALS_CLIENT_ID, INTERVALS_REDIRECT_URI, INTERVALS_CLIENT_SECRET, SITE_URL
|
||||||
@@ -101,7 +102,16 @@ 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)
|
||||||
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:
|
try:
|
||||||
row = rowingdata(csvfile=filename)
|
row = rowingdata(csvfile=filename)
|
||||||
except IOError: # pragma: no cover
|
except IOError: # pragma: no cover
|
||||||
@@ -128,6 +138,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)
|
||||||
@@ -4560,7 +4561,78 @@ class RowerExportForm(ModelForm):
|
|||||||
'rp3_auto_import',
|
'rp3_auto_import',
|
||||||
'intervals_auto_import',
|
'intervals_auto_import',
|
||||||
'intervals_auto_export',
|
'intervals_auto_export',
|
||||||
|
'intervals_resample_to_1s'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class RowerExportFormStrava(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'stravaexportas',
|
||||||
|
'strava_auto_export',
|
||||||
|
'strava_auto_import',
|
||||||
|
'strava_auto_delete',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormIntervals(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'intervals_auto_import',
|
||||||
|
'intervals_auto_export',
|
||||||
|
'intervals_resample_to_1s',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormGarmin(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'garminactivity',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormPolar(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'polar_auto_import',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormConcept2(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'c2_auto_export',
|
||||||
|
'c2_auto_import',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormSportTracks(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'sporttracks_auto_export',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormTrainingPeaks(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'trainingpeaks_auto_export',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormRP3(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'rp3_auto_import',
|
||||||
|
]
|
||||||
|
|
||||||
|
class RowerExportFormNK(ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Rower
|
||||||
|
fields = [
|
||||||
|
'nk_auto_import'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# Simple form to set rower's Functional Threshold Power
|
# Simple form to set rower's Functional Threshold Power
|
||||||
class SimpleRowerPowerForm(ModelForm):
|
class SimpleRowerPowerForm(ModelForm):
|
||||||
|
|||||||
@@ -7,8 +7,10 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Import and Export Settings for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Import and Export Settings for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
<li class="grid_2">
|
<li class="grid_4">
|
||||||
<p>You are currently connected to:
|
<p>You are currently connected to:
|
||||||
{% if rower.c2token is not None and rower.c2token != '' %}
|
{% if rower.c2token is not None and rower.c2token != '' %}
|
||||||
Concept2 Logbook,
|
Concept2 Logbook,
|
||||||
@@ -41,44 +43,133 @@
|
|||||||
Intervals.icu
|
Intervals.icu
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
{% if form.errors %}
|
Click on the icons to establish the connection or to renew the authorization.
|
||||||
<p style="color: red;">
|
</p>
|
||||||
Please correct the error{{ form.errors|pluralize }} below.
|
</li>
|
||||||
</p>
|
<li class="grid_4">
|
||||||
{% endif %}
|
<h2>API Key</h2>
|
||||||
<p>
|
<p>{{ apikey }}</p>
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
<p>
|
||||||
<table>
|
<a href="/rowers/me/regenerateapikey/">Regenerate</a>
|
||||||
{{ form.as_table }}
|
</p>
|
||||||
</table>
|
<p>This API key can be used to access the Rowsandall API. It is used by some third party applications to access your data. Keep it secret.</p>
|
||||||
{% csrf_token %}
|
</li>
|
||||||
<input type="submit" value="Save">
|
|
||||||
</form>
|
{% if form.errors %}
|
||||||
</p>
|
<li class="rounder">
|
||||||
{% if rower.garmintoken and rower.garmintoken != '' %}
|
<p style="color: red;">
|
||||||
<p>
|
Please correct the error{{ form.errors|pluralize }} below.
|
||||||
<em>You are connected to Garmin.</em> Switching off Garmin Connect sync is on the
|
</p>
|
||||||
<a href="https://connect.garmin.com/modern/settings/accountInformation">Account settings</a>
|
</li>
|
||||||
page. Look for the "Rowsandall" app.
|
{% endif %}
|
||||||
</p>
|
<li class="rounder">
|
||||||
{% endif %}
|
<h2>NK</h2>
|
||||||
<p>
|
<table>
|
||||||
Garmin Connnect has no manual sync, so connecting your account to your Garmin account will
|
{{ forms.nk.as_table }}
|
||||||
automatically auto-sync workouts from Garmin to Rowsandall (but not in the other direction). If you
|
<input type="submit" value="Save">
|
||||||
want to export our structured workout sessions to your Garmin device, you have to set the "Garmin Activity"
|
</table>
|
||||||
to a activity type that is supported by your watch. Not all watches support "Custom" activities, so
|
<p><a href="/rowers/me/nkauthorize/"><img src="/static/img/NKLiNKLogbook.png" alt="connect with NK Logbook" width="120"></a></p>
|
||||||
you may have to set your activity to Run or Ride while rowing.
|
</li>
|
||||||
</p>
|
<li class="rounder">
|
||||||
<p>
|
<h2>Concept2</h2>
|
||||||
Strava Auto Import also imports activity changes on Strava to Rowsandall, except when you delete
|
<table>
|
||||||
a workout on Strava. If you want Deletions to propagate to Rowsandall, tick the Strava Auto Delete
|
{{ forms.c2.as_table }}
|
||||||
check box.
|
<input type="submit" value="Save">
|
||||||
</p>
|
</table>
|
||||||
|
<p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
|
||||||
|
</li>
|
||||||
|
<li class="rounder">
|
||||||
|
<h2>RP3</h2>
|
||||||
|
<table>
|
||||||
|
{{ forms.rp3.as_table }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</table>
|
||||||
|
<p><a href="/rowers/me/rp3authorize"><img src="/static/img/logo-rp3-full-black.png"
|
||||||
|
alt="connect with RP3" 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_logo_with_name.png"
|
||||||
|
alt="connect with intervals.icu"></a></p>
|
||||||
|
</li>
|
||||||
|
<li class="rounder">
|
||||||
|
<h2>SportTracks</h2>
|
||||||
|
<table>
|
||||||
|
{{ forms.sporttracks.as_table }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</table>
|
||||||
|
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
|
||||||
|
</li>
|
||||||
|
<li class="rounder">
|
||||||
|
<h2>TrainingPeaks</h2>
|
||||||
|
<table>
|
||||||
|
{{ forms.trainingpeaks.as_table }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</table>
|
||||||
|
<p><a href="/rowers/me/tpauthorize/"><img src="/static/img/TP_logo_horz_2_color.png"
|
||||||
|
alt="connect with Polar" width="130"></a></p>
|
||||||
|
</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>Garmin Connect</h2>
|
||||||
|
<table>
|
||||||
|
{{ forms.garmin.as_table }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</table>
|
||||||
|
<p><a href="/rowers/me/garminauthorize"><img src="/static/img/garmin_badge_130.png"
|
||||||
|
alt="connect with Garmin" width="130"></a></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Garmin Connnect has no manual sync, so connecting your account to your Garmin account will
|
||||||
|
automatically auto-sync workouts from Garmin to Rowsandall (but not in the other direction). If you
|
||||||
|
want to export our structured workout sessions to your Garmin device, you have to set the "Garmin Activity"
|
||||||
|
to a activity type that is supported by your watch. Not all watches support "Custom" activities, so
|
||||||
|
you may have to set your activity to Run or Ride while rowing.
|
||||||
|
</p>
|
||||||
|
{% if rower.garmintoken and rower.garmintoken != '' %}
|
||||||
|
<p>
|
||||||
|
<em>You are connected to Garmin.</em> Switching off Garmin Connect sync is on the
|
||||||
|
<a href="https://connect.garmin.com/modern/settings/accountInformation">Account settings</a>
|
||||||
|
page. Look for the "Rowsandall" app.
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
<li class="rounder">
|
||||||
|
<h2>Strava</h2>
|
||||||
|
<p><input type="submit" value="Save"></p>
|
||||||
|
{{ forms.strava.as_p }}
|
||||||
|
<p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p>
|
||||||
|
<p>
|
||||||
|
Strava Auto Import also imports activity changes on Strava to Rowsandall, except when you delete
|
||||||
|
a workout on Strava. If you want Deletions to propagate to Rowsandall, tick the Strava Auto Delete
|
||||||
|
check box.
|
||||||
|
</p>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_2">
|
|
||||||
{% if grants %}
|
{% if grants %}
|
||||||
|
<li class="rounder">
|
||||||
<h2>Applications</h2>
|
<h2>Applications</h2>
|
||||||
|
<p>
|
||||||
|
These applications have access to your Rowsandall data.
|
||||||
|
</p>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -99,35 +190,12 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>API Key</h2>
|
|
||||||
<p>{{ apikey }}</p>
|
|
||||||
<p>
|
|
||||||
<a href="/rowers/me/regenerateapikey/">Regenerate</a>
|
|
||||||
</p>
|
|
||||||
This API key can be used to access the Rowsandall API. It is used by some third party applications to access your data. Keep it secret.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>Click on one of the icons below to connect to the service of your
|
</form>
|
||||||
choice or to renew the authorization.</p>
|
|
||||||
<p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p>
|
|
||||||
<p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
|
|
||||||
<p><a href="/rowers/me/nkauthorize/"><img src="/static/img/NKLiNKLogbook.png" alt="connect with NK Logbook" width="120"></a></p>
|
|
||||||
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
|
|
||||||
<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/tpauthorize/"><img src="/static/img/TP_logo_horz_2_color.png"
|
|
||||||
alt="connect with Polar" width="130"></a></p>
|
|
||||||
|
|
||||||
<p><a href="/rowers/me/garminauthorize"><img src="/static/img/garmin_badge_130.png"
|
|
||||||
alt="connect with Garmin" width="130"></a></p>
|
|
||||||
<p><a href="/rowers/me/rp3authorize"><img src="/static/img/logo-rp3-full-black.png"
|
|
||||||
alt="connect with RP3" width="130"></a></p>
|
|
||||||
<p><a href="/rowers/me/rojaboauthorize"><img src="/static/img/rojabo.png"
|
|
||||||
alt="connect with Rojabo" width="130"></a></p>
|
|
||||||
<p><a href="/rowers/me/intervalsauthorize"><img src="/static/img/intervals_icu.png"
|
|
||||||
alt="connect with intervals.icu" height="30"></a></p>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
+19
-17
@@ -245,23 +245,6 @@ def do_sync(w, options, quick=False):
|
|||||||
dologging('c2_log.log','Error C2')
|
dologging('c2_log.log','Error C2')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if do_strava_export: # pragma: no cover
|
|
||||||
strava_integration = StravaIntegration(w.user.user)
|
|
||||||
try:
|
|
||||||
id = strava_integration.workout_export(w)
|
|
||||||
dologging(
|
|
||||||
'strava_export_log.log',
|
|
||||||
'exporting workout {id} as {type}'.format(
|
|
||||||
id=w.id,
|
|
||||||
type=w.workouttype,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
except NoTokenError: # pragma: no cover
|
|
||||||
id = 0
|
|
||||||
message = "Please connect to Strava first"
|
|
||||||
except Exception as e:
|
|
||||||
dologging('stravalog.log', e)
|
|
||||||
|
|
||||||
if do_icu_export:
|
if do_icu_export:
|
||||||
intervals_integration = IntervalsIntegration(w.user.user)
|
intervals_integration = IntervalsIntegration(w.user.user)
|
||||||
try:
|
try:
|
||||||
@@ -334,4 +317,23 @@ def do_sync(w, options, quick=False):
|
|||||||
dologging('tp_export.log','No Token Error')
|
dologging('tp_export.log','No Token Error')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
# we do Strava last.
|
||||||
|
if do_strava_export: # pragma: no cover
|
||||||
|
strava_integration = StravaIntegration(w.user.user)
|
||||||
|
try:
|
||||||
|
id = strava_integration.workout_export(w)
|
||||||
|
dologging(
|
||||||
|
'strava_export_log.log',
|
||||||
|
'exporting workout {id} as {type}'.format(
|
||||||
|
id=w.id,
|
||||||
|
type=w.workouttype,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except NoTokenError: # pragma: no cover
|
||||||
|
id = 0
|
||||||
|
message = "Please connect to Strava first"
|
||||||
|
except Exception as e:
|
||||||
|
dologging('stravalog.log', e)
|
||||||
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -179,7 +179,13 @@ from rowers.models import ( RowerPowerForm, RowerHRZonesForm, SimpleRowerPowerFo
|
|||||||
IndoorVirtualRaceForm, PlannedSessionCommentForm, Alert,
|
IndoorVirtualRaceForm, PlannedSessionCommentForm, Alert,
|
||||||
Condition, StaticChartRowerForm, FollowerForm,
|
Condition, StaticChartRowerForm, FollowerForm,
|
||||||
VirtualRaceAthleteForm, InstantPlanForm, DataRowerForm,
|
VirtualRaceAthleteForm, InstantPlanForm, DataRowerForm,
|
||||||
StepEditorForm, iDokladToken )
|
StepEditorForm, iDokladToken,
|
||||||
|
RowerExportFormStrava, RowerExportFormPolar,
|
||||||
|
RowerExportFormSportTracks, RowerExportFormTrainingPeaks,
|
||||||
|
RowerExportFormConcept2, RowerExportFormGarmin,
|
||||||
|
RowerExportFormIntervals, RowerExportFormRP3,
|
||||||
|
RowerExportFormNK,
|
||||||
|
)
|
||||||
from rowers.models import (
|
from rowers.models import (
|
||||||
FavoriteForm, BaseFavoriteFormSet, SiteAnnouncement, BasePlannedSessionFormSet,
|
FavoriteForm, BaseFavoriteFormSet, SiteAnnouncement, BasePlannedSessionFormSet,
|
||||||
get_course_timezone, BaseConditionFormSet,
|
get_course_timezone, BaseConditionFormSet,
|
||||||
|
|||||||
@@ -457,19 +457,43 @@ def rower_exportsettings_view(request, userid=0):
|
|||||||
'polar_auto_import': 'polartoken',
|
'polar_auto_import': 'polartoken',
|
||||||
'c2_auto_export': 'c2token',
|
'c2_auto_export': 'c2token',
|
||||||
'c2_auto_import': 'c2token',
|
'c2_auto_import': 'c2token',
|
||||||
'runkeeper_auto_export': 'runkeepertoken',
|
|
||||||
'sporttracks_auto_export': 'sporttrackstoken',
|
'sporttracks_auto_export': 'sporttrackstoken',
|
||||||
'strava_auto_export': 'stravatoken',
|
'strava_auto_export': 'stravatoken',
|
||||||
'strava_auto_import': 'stravatoken',
|
'strava_auto_import': 'stravatoken',
|
||||||
'strava_auto_delete': 'stravatoken',
|
'strava_auto_delete': 'stravatoken',
|
||||||
'trainingpeaks_auto_export': 'tptoken',
|
'trainingpeaks_auto_export': 'tptoken',
|
||||||
'rp3_auto_import': 'rp3token',
|
'rp3_auto_import': 'rp3token',
|
||||||
'nk_auto_import': 'nktoken'
|
'nk_auto_import': 'nktoken',
|
||||||
|
'intervals_auto_export': 'intervals_token',
|
||||||
|
'intervals_resample_to_1s': 'intervals_token',
|
||||||
}
|
}
|
||||||
r = getrequestrowercoachee(request, userid=userid)
|
r = getrequestrowercoachee(request, userid=userid)
|
||||||
|
|
||||||
|
forms = {
|
||||||
|
'polar': RowerExportFormPolar(instance=r),
|
||||||
|
'c2': RowerExportFormConcept2(instance=r),
|
||||||
|
'sporttracks': RowerExportFormSportTracks(instance=r),
|
||||||
|
'strava': RowerExportFormStrava(instance=r),
|
||||||
|
'trainingpeaks': RowerExportFormTrainingPeaks(instance=r),
|
||||||
|
'rp3': RowerExportFormRP3(instance=r),
|
||||||
|
'intervals': RowerExportFormIntervals(instance=r),
|
||||||
|
'nk': RowerExportFormNK(instance=r),
|
||||||
|
'garmin': RowerExportFormGarmin(instance=r),
|
||||||
|
}
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = RowerExportForm(request.POST)
|
form = RowerExportForm(request.POST)
|
||||||
|
forms = {
|
||||||
|
'polar': RowerExportFormPolar(request.POST, instance=r),
|
||||||
|
'c2': RowerExportFormConcept2(request.POST, instance=r),
|
||||||
|
'sporttracks': RowerExportFormSportTracks(request.POST, instance=r),
|
||||||
|
'strava': RowerExportFormStrava(request.POST, instance=r),
|
||||||
|
'trainingpeaks': RowerExportFormTrainingPeaks(request.POST, instance=r),
|
||||||
|
'rp3': RowerExportFormRP3(request.POST, instance=r),
|
||||||
|
'intervals': RowerExportFormIntervals(request.POST, instance=r),
|
||||||
|
'nk': RowerExportFormNK(request.POST, instance=r),
|
||||||
|
'garmin': RowerExportFormGarmin(request.POST, instance=r),
|
||||||
|
}
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
if r.rowerplan == 'basic': # pragma: no cover
|
if r.rowerplan == 'basic': # pragma: no cover
|
||||||
@@ -528,6 +552,7 @@ def rower_exportsettings_view(request, userid=0):
|
|||||||
|
|
||||||
return render(request, 'rower_exportsettings.html',
|
return render(request, 'rower_exportsettings.html',
|
||||||
{'form': form,
|
{'form': form,
|
||||||
|
'forms': forms,
|
||||||
'rower': r,
|
'rower': r,
|
||||||
'breadcrumbs': breadcrumbs,
|
'breadcrumbs': breadcrumbs,
|
||||||
'grants': grants,
|
'grants': grants,
|
||||||
|
|||||||
@@ -5609,17 +5609,6 @@ def workout_upload_view(request,
|
|||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
if not is_ajax:
|
if not is_ajax:
|
||||||
if r.c2_auto_export and ispromember(r.user): # pragma: no cover
|
|
||||||
uploadoptions['upload_to_C2'] = True
|
|
||||||
|
|
||||||
if r.strava_auto_export and ispromember(r.user): # pragma: no cover
|
|
||||||
uploadoptions['upload_to_Strava'] = True
|
|
||||||
|
|
||||||
if r.sporttracks_auto_export and ispromember(r.user): # pragma: no cover
|
|
||||||
uploadoptions['upload_to_SportTracks'] = True
|
|
||||||
|
|
||||||
if r.trainingpeaks_auto_export and ispromember(r.user): # pragma: no cover
|
|
||||||
uploadoptions['upload_to_TrainingPeaks'] = True
|
|
||||||
|
|
||||||
form = DocumentsForm(initial=docformoptions)
|
form = DocumentsForm(initial=docformoptions)
|
||||||
optionsform = UploadOptionsForm(initial=uploadoptions,
|
optionsform = UploadOptionsForm(initial=uploadoptions,
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Reference in New Issue
Block a user