Merge branch 'release/v23.1.14'
This commit is contained in:
@@ -1232,10 +1232,11 @@ bulkactions = (
|
|||||||
('unset commute','unset commute'),
|
('unset commute','unset commute'),
|
||||||
)
|
)
|
||||||
destinations = (
|
destinations = (
|
||||||
('c2','c2'),
|
('c2','concept2'),
|
||||||
('strava','strava'),
|
('strava','strava'),
|
||||||
('sporttracks','sporttracks'),
|
('sporttracks','sporttracks'),
|
||||||
('trainingpeaks','trainingpeaks')
|
('trainingpeaks','trainingpeaks'),
|
||||||
|
('intervals','intervals.icu')
|
||||||
)
|
)
|
||||||
|
|
||||||
class WorkoutBulkActions(forms.Form):
|
class WorkoutBulkActions(forms.Form):
|
||||||
|
|||||||
@@ -79,13 +79,17 @@ class TPIntegration(SyncIntegration):
|
|||||||
def workout_export(self, workout, *args, **kwargs) -> str:
|
def workout_export(self, workout, *args, **kwargs) -> str:
|
||||||
thetoken = self.open()
|
thetoken = self.open()
|
||||||
tcxfilename = self.createworkoutdata(workout)
|
tcxfilename = self.createworkoutdata(workout)
|
||||||
|
try:
|
||||||
|
wtype = tpmapping[workout.workouttype]
|
||||||
|
except KeyError:
|
||||||
|
wtype = 'rowing'
|
||||||
job = myqueue(
|
job = myqueue(
|
||||||
queue,
|
queue,
|
||||||
handle_workout_tp_upload,
|
handle_workout_tp_upload,
|
||||||
workout,
|
workout,
|
||||||
thetoken,
|
thetoken,
|
||||||
tcxfilename,
|
tcxfilename,
|
||||||
tpmapping[workout.workouttype]
|
wtype
|
||||||
)
|
)
|
||||||
return job.id
|
return job.id
|
||||||
|
|
||||||
|
|||||||
@@ -2755,6 +2755,12 @@ class PlannedSessionStep(models.Model):
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
# string
|
||||||
|
def __str__(self):
|
||||||
|
str = 'Step {id} {name} {intensity}'.format(id=self.pk, name=self.name, intensity=self.intensity)
|
||||||
|
|
||||||
|
return str
|
||||||
|
|
||||||
class StepEditorForm(ModelForm):
|
class StepEditorForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PlannedSessionStep
|
model = PlannedSessionStep
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<section class="drop-zone">
|
<section class="drop-zone">
|
||||||
<h2>Training Steps for {{ ps.name }}</h2>
|
<h2>Training Steps for {{ ps.name }}</h2>
|
||||||
<p>
|
<p>
|
||||||
<form onsubmit="event.preventDefault(); saveSession();">
|
<form target="/rowers/plans/stepadder/{{ ps.id}}/?save=1" onsubmit="event.preventDefault(); saveSession();">
|
||||||
<input id="hidden" type="hidden" value="">
|
<input id="hidden" type="hidden" value="">
|
||||||
<input id="savebutton" type="submit" value="Save">
|
<input id="savebutton" type="submit" value="Save">
|
||||||
</form>
|
</form>
|
||||||
@@ -218,7 +218,10 @@
|
|||||||
console.log(result)
|
console.log(result)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
window.location.reload(true);
|
saveState();
|
||||||
|
// reload the page
|
||||||
|
location.reload();
|
||||||
|
// window.location.reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveState() {
|
function saveState() {
|
||||||
@@ -345,7 +348,7 @@
|
|||||||
if (target && dragged) {
|
if (target && dragged) {
|
||||||
target.style.backgroundColor = '';
|
target.style.backgroundColor = '';
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// Get the id of the target and add the moved element to the target's DOM
|
// Get the id of the target and add the moved element to the targets DOM
|
||||||
// dragged.parentNode.removeChild(dragged);
|
// dragged.parentNode.removeChild(dragged);
|
||||||
if (target.nodeName == "SECTION") {
|
if (target.nodeName == "SECTION") {
|
||||||
dragged.style.opacity = '';
|
dragged.style.opacity = '';
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -130,6 +130,9 @@ def make_plot(r, w, f1, f2, plottype, title, imagename='', plotnr=0):
|
|||||||
|
|
||||||
|
|
||||||
def do_sync(w, options, quick=False):
|
def do_sync(w, options, quick=False):
|
||||||
|
if w.duplicate:
|
||||||
|
return 0
|
||||||
|
|
||||||
do_strava_export = False
|
do_strava_export = False
|
||||||
if w.user.strava_auto_export is True:
|
if w.user.strava_auto_export is True:
|
||||||
do_strava_export = True
|
do_strava_export = True
|
||||||
@@ -236,8 +239,6 @@ def do_sync(w, options, quick=False):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if w.duplicate:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if do_c2_export: # pragma: no cover
|
if do_c2_export: # pragma: no cover
|
||||||
dologging('c2_log.log','Exporting workout to C2 for user {user}'.format(user=w.user.user.id))
|
dologging('c2_log.log','Exporting workout to C2 for user {user}'.format(user=w.user.user.id))
|
||||||
@@ -305,7 +306,6 @@ def do_sync(w, options, quick=False):
|
|||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
dologging('st_export.log','No Token Error')
|
dologging('st_export.log','No Token Error')
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
do_tp_export = w.user.trainingpeaks_auto_export
|
do_tp_export = w.user.trainingpeaks_auto_export
|
||||||
try:
|
try:
|
||||||
@@ -315,6 +315,8 @@ def do_sync(w, options, quick=False):
|
|||||||
do_tp_export = upload_to_tp
|
do_tp_export = upload_to_tp
|
||||||
except KeyError:
|
except KeyError:
|
||||||
upload_to_st = False
|
upload_to_st = False
|
||||||
|
|
||||||
|
|
||||||
if do_tp_export:
|
if do_tp_export:
|
||||||
try:
|
try:
|
||||||
tp_integration = TPIntegration(w.user.user)
|
tp_integration = TPIntegration(w.user.user)
|
||||||
@@ -327,7 +329,6 @@ def do_sync(w, options, quick=False):
|
|||||||
)
|
)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
dologging('tp_export.log','No Token Error')
|
dologging('tp_export.log','No Token Error')
|
||||||
return 0
|
|
||||||
|
|
||||||
# we do Strava last.
|
# we do Strava last.
|
||||||
if do_strava_export: # pragma: no cover
|
if do_strava_export: # pragma: no cover
|
||||||
|
|||||||
@@ -740,6 +740,10 @@ def steps_write_fit(steps):
|
|||||||
# convert to json, value of keys called wkt_step_name to string
|
# convert to json, value of keys called wkt_step_name to string
|
||||||
for step in steps['steps']:
|
for step in steps['steps']:
|
||||||
step['wkt_step_name'] = str(step['wkt_step_name'])
|
step['wkt_step_name'] = str(step['wkt_step_name'])
|
||||||
|
# convert numerical values in the dict to integers
|
||||||
|
for key in step.keys():
|
||||||
|
if isinstance(step[key], (int, float)):
|
||||||
|
step[key] = int(step[key])
|
||||||
|
|
||||||
response = requests.post(url=url, headers=headers, json=steps)
|
response = requests.post(url=url, headers=headers, json=steps)
|
||||||
|
|
||||||
|
|||||||
@@ -3077,6 +3077,7 @@ def rower_create_trainingplan(request, id=0):
|
|||||||
'old_targets': old_targets,
|
'old_targets': old_targets,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
@user_passes_test(can_plan, login_url="/rowers/paidplans",
|
@user_passes_test(can_plan, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Coach or Self-Coach plan",
|
message="This functionality requires a Coach or Self-Coach plan",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@@ -3116,6 +3117,7 @@ def stepadder(request, id=0):
|
|||||||
'message': 'permission denied for host '+hostt[0]}
|
'message': 'permission denied for host '+hostt[0]}
|
||||||
return JSONResponse(status=403, data=message)
|
return JSONResponse(status=403, data=message)
|
||||||
|
|
||||||
|
|
||||||
if ps.steps:
|
if ps.steps:
|
||||||
filename = ps.steps.get('filename','')
|
filename = ps.steps.get('filename','')
|
||||||
sport = ps.steps.get('sport','rowing')
|
sport = ps.steps.get('sport','rowing')
|
||||||
@@ -3202,12 +3204,13 @@ def stepedit(request, id=0, psid=0):
|
|||||||
if form.cleaned_data['durationtype'] == 'Time':
|
if form.cleaned_data['durationtype'] == 'Time':
|
||||||
ss['durationValue'] = form.cleaned_data['durationvalue']*60000
|
ss['durationValue'] = form.cleaned_data['durationvalue']*60000
|
||||||
elif form.cleaned_data['durationtype'] == 'Distance':
|
elif form.cleaned_data['durationtype'] == 'Distance':
|
||||||
ss[durationValue] = form.cleaned_data['durationvalue']*100
|
ss['durationValue'] = form.cleaned_data['durationvalue']*100
|
||||||
|
|
||||||
ss['durationValue'] = int(ss['durationValue'])
|
ss['durationValue'] = int(ss['durationValue'])
|
||||||
ps.fitfile = None
|
ps.fitfile = None
|
||||||
ps.interval_string = ""
|
ps.interval_string = ""
|
||||||
|
|
||||||
|
|
||||||
ps.save()
|
ps.save()
|
||||||
|
|
||||||
step.durationtype = form.cleaned_data['durationtype']
|
step.durationtype = form.cleaned_data['durationtype']
|
||||||
|
|||||||
@@ -2044,6 +2044,12 @@ def workouts_bulk_actions(request):
|
|||||||
workoutids = request.session.get('ids',[])
|
workoutids = request.session.get('ids',[])
|
||||||
workouts = []
|
workouts = []
|
||||||
exportchoice = 'strava'
|
exportchoice = 'strava'
|
||||||
|
|
||||||
|
# exportchoice = ExportChoices()
|
||||||
|
actionform = WorkoutBulkActions()
|
||||||
|
actionform.fields["action"].initial = action
|
||||||
|
assignchoices = AssignChoices()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for encid in workoutids:
|
for encid in workoutids:
|
||||||
w = get_workout_by_opaqueid(request, encid)
|
w = get_workout_by_opaqueid(request, encid)
|
||||||
@@ -2286,8 +2292,7 @@ def workouts_view(request, message='', successmessage='',
|
|||||||
(Q(name__icontains=q) for q in query_list)) |
|
(Q(name__icontains=q) for q in query_list)) |
|
||||||
reduce(operator.and_,
|
reduce(operator.and_,
|
||||||
(Q(notes__icontains=q) for q in query_list)),
|
(Q(notes__icontains=q) for q in query_list)),
|
||||||
exclude_strava=False,
|
).exclude(workoutsource='strava')
|
||||||
)
|
|
||||||
searchform = SearchForm(initial={'q': query})
|
searchform = SearchForm(initial={'q': query})
|
||||||
else:
|
else:
|
||||||
searchform = SearchForm()
|
searchform = SearchForm()
|
||||||
|
|||||||
Reference in New Issue
Block a user