workouttype detection fit
This commit is contained in:
@@ -1426,13 +1426,17 @@ def get_workouttype_from_fit(filename, workouttype=None):
|
|||||||
if record.name in ['sport', 'lap','session']:
|
if record.name in ['sport', 'lap','session']:
|
||||||
try:
|
try:
|
||||||
fittype = record.get_values()['sport'].lower()
|
fittype = record.get_values()['sport'].lower()
|
||||||
|
try:
|
||||||
|
workouttype = mytypes.fitmappinginv[fittype]
|
||||||
|
except KeyError:
|
||||||
|
workouttype = ''
|
||||||
try:
|
try:
|
||||||
subsporttype = record.get_values()['sub_sport'].lower()
|
subsporttype = record.get_values()['sub_sport'].lower()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
subsporttype = ''
|
subsporttype = ''
|
||||||
except (KeyError, AttributeError): # pragma: no cover
|
except (KeyError, AttributeError): # pragma: no cover
|
||||||
pass
|
pass
|
||||||
if subsporttype:
|
if subsporttype and workouttype == '':
|
||||||
try:
|
try:
|
||||||
workouttype = mytypes.fitmappinginv[subsporttype]
|
workouttype = mytypes.fitmappinginv[subsporttype]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -1442,8 +1446,8 @@ def get_workouttype_from_fit(filename, workouttype=None):
|
|||||||
workouttype = mytypes.fitmappinginv[fittype]
|
workouttype = mytypes.fitmappinginv[fittype]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
if workouttype_orig in ['water', 'rower']:
|
#if workouttype_orig in ['water', 'rower']:
|
||||||
workouttype = workouttype_orig
|
# workouttype = workouttype_orig
|
||||||
|
|
||||||
return workouttype
|
return workouttype
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user