fixes fixes
This commit is contained in:
@@ -1232,10 +1232,11 @@ bulkactions = (
|
||||
('unset commute','unset commute'),
|
||||
)
|
||||
destinations = (
|
||||
('c2','c2'),
|
||||
('c2','concept2'),
|
||||
('strava','strava'),
|
||||
('sporttracks','sporttracks'),
|
||||
('trainingpeaks','trainingpeaks')
|
||||
('trainingpeaks','trainingpeaks'),
|
||||
('intervals','intervals.icu')
|
||||
)
|
||||
|
||||
class WorkoutBulkActions(forms.Form):
|
||||
|
||||
@@ -79,13 +79,17 @@ class TPIntegration(SyncIntegration):
|
||||
def workout_export(self, workout, *args, **kwargs) -> str:
|
||||
thetoken = self.open()
|
||||
tcxfilename = self.createworkoutdata(workout)
|
||||
try:
|
||||
wtype = tpmapping[workout.workouttype]
|
||||
except KeyError:
|
||||
wtype = 'rowing'
|
||||
job = myqueue(
|
||||
queue,
|
||||
handle_workout_tp_upload,
|
||||
workout,
|
||||
thetoken,
|
||||
tcxfilename,
|
||||
tpmapping[workout.workouttype]
|
||||
wtype
|
||||
)
|
||||
return job.id
|
||||
|
||||
|
||||
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):
|
||||
if w.duplicate:
|
||||
return 0
|
||||
|
||||
do_strava_export = False
|
||||
if w.user.strava_auto_export is True:
|
||||
do_strava_export = True
|
||||
@@ -236,8 +239,6 @@ def do_sync(w, options, quick=False):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if w.duplicate:
|
||||
return 0
|
||||
|
||||
if do_c2_export: # pragma: no cover
|
||||
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:
|
||||
dologging('st_export.log','No Token Error')
|
||||
|
||||
return 0
|
||||
|
||||
do_tp_export = w.user.trainingpeaks_auto_export
|
||||
try:
|
||||
@@ -315,6 +315,8 @@ def do_sync(w, options, quick=False):
|
||||
do_tp_export = upload_to_tp
|
||||
except KeyError:
|
||||
upload_to_st = False
|
||||
|
||||
|
||||
if do_tp_export:
|
||||
try:
|
||||
tp_integration = TPIntegration(w.user.user)
|
||||
@@ -327,7 +329,6 @@ def do_sync(w, options, quick=False):
|
||||
)
|
||||
except NoTokenError:
|
||||
dologging('tp_export.log','No Token Error')
|
||||
return 0
|
||||
|
||||
# we do Strava last.
|
||||
if do_strava_export: # pragma: no cover
|
||||
|
||||
@@ -50,7 +50,6 @@ def download_fit(request, filename=''):
|
||||
try:
|
||||
response = HttpResponse(fitfile)
|
||||
except FileNotFoundError:
|
||||
print(fitfile, "not found")
|
||||
raise Http404("File not found")
|
||||
|
||||
response['Content-Disposition'] = 'attachment; filename="%s"' % filename # pragma: no cover
|
||||
|
||||
@@ -2044,6 +2044,12 @@ def workouts_bulk_actions(request):
|
||||
workoutids = request.session.get('ids',[])
|
||||
workouts = []
|
||||
exportchoice = 'strava'
|
||||
|
||||
# exportchoice = ExportChoices()
|
||||
actionform = WorkoutBulkActions()
|
||||
actionform.fields["action"].initial = action
|
||||
assignchoices = AssignChoices()
|
||||
|
||||
try:
|
||||
for encid in workoutids:
|
||||
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)) |
|
||||
reduce(operator.and_,
|
||||
(Q(notes__icontains=q) for q in query_list)),
|
||||
exclude_strava=False,
|
||||
)
|
||||
).exclude(workoutsource='strava')
|
||||
searchform = SearchForm(initial={'q': query})
|
||||
else:
|
||||
searchform = SearchForm()
|
||||
|
||||
Reference in New Issue
Block a user