From 3e9c23b03f0c26299591793687bc2af09669784c Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Wed, 11 Dec 2024 19:23:44 +0100 Subject: [PATCH] temp logging --- rowers/integrations/intervals.py | 3 ++- rowers/integrations/trainingpeaks.py | 2 +- rowers/mytypes.py | 33 ++++++++++++++++++++++++++++ rowers/views/workoutviews.py | 2 ++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/rowers/integrations/intervals.py b/rowers/integrations/intervals.py index 4437019e..b55a50a4 100644 --- a/rowers/integrations/intervals.py +++ b/rowers/integrations/intervals.py @@ -128,7 +128,7 @@ class IntervalsIntegration(SyncIntegration): except TypeError: newnotes = 'from'+w.workoutsource+' via rowsandall.com' - row.exporttotcx(tcxfilename, notes=newnotes) + row.exporttotcx(tcxfilename, notes=newnotes, sport=mytypes.intervalsmapping[w.workouttype]) if dozip: gzfilename = tcxfilename + '.gz' try: @@ -181,6 +181,7 @@ class IntervalsIntegration(SyncIntegration): # set workout type to workouttype url = "https://intervals.icu/api/v1/activity/{activityid}".format(activityid=id) + thetype = mytypes.intervalsmapping[workout.workouttype] response = requests.put(url, headers=headers, json={'type': thetype}) diff --git a/rowers/integrations/trainingpeaks.py b/rowers/integrations/trainingpeaks.py index 404801de..efe98532 100644 --- a/rowers/integrations/trainingpeaks.py +++ b/rowers/integrations/trainingpeaks.py @@ -66,7 +66,7 @@ class TPIntegration(SyncIntegration): except TypeError: newnotes = 'from '+w.workoutsource+' via rowsandall.com' - row.exporttotcx(tcxfilename, notes=newnotes) + row.exporttotcx(tcxfilename, notes=newnotes, sport=tpmapping(w.workouttype)) return tcxfilename diff --git a/rowers/mytypes.py b/rowers/mytypes.py index 3f19525c..194793fe 100644 --- a/rowers/mytypes.py +++ b/rowers/mytypes.py @@ -181,7 +181,40 @@ fitcollection = ( fitmapping = {key: value for key, value in Reverse(fitcollection)} +tcxcollection = ( + ('water', 'Rowing'), + ('rower', 'Rowing'), + ('skierg', 'CrossCountrySkiing'), + ('bike', 'Biking'), + ('bikeerg', 'Biking'), + ('dynamic', 'Rowing'), + ('slides', 'Rowing'), + ('paddle', 'Other'), + ('snow', 'CrossCountrySkiing'), + ('coastal', 'Rowing'), + ('c-boat', 'Rowing'), + ('churchboat', 'Rowing'), + ('Ride', 'Biking'), + ('Run', 'Running'), + ('NordicSki', 'CrossCountrySkiing'), + ('Swim', 'Swimming'), + ('Hike', 'Hiking'), + ('Walk', 'Walking'), + ('Canoeing', 'Other'), + ('Crossfit', 'Other'), + ('StandUpPaddling', 'Other'), + ('IceSkate', 'Other'), + ('WeightTraining', 'Other'), + ('InlineSkate', 'Other'), + ('Kayaking', 'Other'), + ('Workout', 'Other'), + ('Yoga', 'Other'), + ('other', 'Other'), +) +tcxmapping = {key: value for key, value in Reverse(tcxcollection)} + +tcxmappinginv = {value: key for key, value in Reverse(tcxcollection) if value is not None} intervalscollection = ( ('water', 'Rowing'), diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index 14112726..a27e3887 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -4971,6 +4971,8 @@ def workout_upload_api(request): message = {'status': 'false', 'message': 'could not find file'} return JSONResponse(status=400, data=message) + dologging('own_api.log','-temp-') + dologging('own_api.log',post_data) # sync related IDs sporttracksid = post_data.get('sporttracksid','')