Private
Public Access
1
0

fixes fixes

This commit is contained in:
2025-01-25 14:56:37 +01:00
parent 7190d97d29
commit 3c68672678
6 changed files with 20 additions and 10 deletions

View File

@@ -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):

View File

@@ -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

Binary file not shown.

View File

@@ -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

View File

@@ -50,7 +50,6 @@ def download_fit(request, filename=''):
try: try:
response = HttpResponse(fitfile) response = HttpResponse(fitfile)
except FileNotFoundError: except FileNotFoundError:
print(fitfile, "not found")
raise Http404("File not found") raise Http404("File not found")
response['Content-Disposition'] = 'attachment; filename="%s"' % filename # pragma: no cover response['Content-Disposition'] = 'attachment; filename="%s"' % filename # pragma: no cover

View File

@@ -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()