ready for merge back
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -4561,6 +4561,7 @@ 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 RowerExportFormStrava(ModelForm):
|
||||||
@@ -4616,7 +4617,6 @@ class RowerExportFormTrainingPeaks(ModelForm):
|
|||||||
model = Rower
|
model = Rower
|
||||||
fields = [
|
fields = [
|
||||||
'trainingpeaks_auto_export',
|
'trainingpeaks_auto_export',
|
||||||
'rp3_auto_import',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
class RowerExportFormRP3(ModelForm):
|
class RowerExportFormRP3(ModelForm):
|
||||||
|
|||||||
@@ -64,13 +64,12 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Intervals.icu</h2>
|
<h2>NK</h2>
|
||||||
<table>
|
<table>
|
||||||
{{ forms.intervals.as_table }}
|
{{ forms.nk.as_table }}
|
||||||
<input type="submit" value="Save">
|
<input type="submit" value="Save">
|
||||||
</table>
|
</table>
|
||||||
<p><a href="/rowers/me/intervalsauthorize"><img src="/static/img/intervals_icu.png"
|
<p><a href="/rowers/me/nkauthorize/"><img src="/static/img/NKLiNKLogbook.png" alt="connect with NK Logbook" width="120"></a></p>
|
||||||
alt="connect with intervals.icu"></a></p>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Concept2</h2>
|
<h2>Concept2</h2>
|
||||||
@@ -81,12 +80,27 @@
|
|||||||
<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/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
|
||||||
</li>
|
</li>
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>NK</h2>
|
<h2>RP3</h2>
|
||||||
<table>
|
<table>
|
||||||
{{ forms.nk.as_table }}
|
{{ forms.rp3.as_table }}
|
||||||
<input type="submit" value="Save">
|
<input type="submit" value="Save">
|
||||||
</table>
|
</table>
|
||||||
<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/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>
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>SportTracks</h2>
|
<h2>SportTracks</h2>
|
||||||
@@ -102,6 +116,8 @@
|
|||||||
{{ forms.trainingpeaks.as_table }}
|
{{ forms.trainingpeaks.as_table }}
|
||||||
<input type="submit" value="Save">
|
<input type="submit" value="Save">
|
||||||
</table>
|
</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>
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Polar</h2>
|
<h2>Polar</h2>
|
||||||
@@ -112,11 +128,6 @@
|
|||||||
<p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png"
|
<p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png"
|
||||||
alt="connect with Polar" width="130"></a></p>
|
alt="connect with Polar" width="130"></a></p>
|
||||||
</li>
|
</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">
|
<li class="rounder">
|
||||||
<h2>Garmin Connect</h2>
|
<h2>Garmin Connect</h2>
|
||||||
<table>
|
<table>
|
||||||
@@ -153,24 +164,6 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
</li>
|
</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>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>
|
|
||||||
{% if grants %}
|
{% if grants %}
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Applications</h2>
|
<h2>Applications</h2>
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -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
|
||||||
|
|||||||
@@ -465,6 +465,7 @@ def rower_exportsettings_view(request, userid=0):
|
|||||||
'rp3_auto_import': 'rp3token',
|
'rp3_auto_import': 'rp3token',
|
||||||
'nk_auto_import': 'nktoken',
|
'nk_auto_import': 'nktoken',
|
||||||
'intervals_auto_export': 'intervals_token',
|
'intervals_auto_export': 'intervals_token',
|
||||||
|
'intervals_resample_to_1s': 'intervals_token',
|
||||||
}
|
}
|
||||||
r = getrequestrowercoachee(request, userid=userid)
|
r = getrequestrowercoachee(request, userid=userid)
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
BIN
static/img/intervals_logo_with_name.png
Normal file
BIN
static/img/intervals_logo_with_name.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Reference in New Issue
Block a user