From 336e66106c8e489536b1b25204665caad349e1c5 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 9 Jan 2025 18:55:51 +0100 Subject: [PATCH] workouttype detection fit --- rowers/dataroutines.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index 851032e7..aa4e32ba 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -1426,13 +1426,17 @@ def get_workouttype_from_fit(filename, workouttype=None): if record.name in ['sport', 'lap','session']: try: fittype = record.get_values()['sport'].lower() + try: + workouttype = mytypes.fitmappinginv[fittype] + except KeyError: + workouttype = '' try: subsporttype = record.get_values()['sub_sport'].lower() except KeyError: subsporttype = '' except (KeyError, AttributeError): # pragma: no cover pass - if subsporttype: + if subsporttype and workouttype == '': try: workouttype = mytypes.fitmappinginv[subsporttype] except KeyError: @@ -1442,8 +1446,8 @@ def get_workouttype_from_fit(filename, workouttype=None): workouttype = mytypes.fitmappinginv[fittype] except KeyError: pass - if workouttype_orig in ['water', 'rower']: - workouttype = workouttype_orig + #if workouttype_orig in ['water', 'rower']: + # workouttype = workouttype_orig return workouttype