trying to get sub label showed properly
This commit is contained in:
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
from lxml import etree
|
||||
|
||||
from bincio.extract.models import DataPoint, ParsedActivity
|
||||
from bincio.extract.sport import normalise_sport
|
||||
from bincio.extract.sport import normalise_sport, normalise_sub_sport
|
||||
|
||||
_NS_HTTP = {
|
||||
"tcx": "http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2",
|
||||
@@ -33,7 +33,8 @@ class TcxParser:
|
||||
# Use the first activity
|
||||
act = activities[0]
|
||||
sport_attr = act.get("Sport", "Biking")
|
||||
sport = normalise_sport(sport_attr)
|
||||
sport = normalise_sport(sport_attr)
|
||||
sub_sport = normalise_sub_sport(sport_attr)
|
||||
|
||||
points: list[DataPoint] = []
|
||||
for tp in act.findall(".//tcx:Trackpoint", _NS):
|
||||
@@ -78,6 +79,7 @@ class TcxParser:
|
||||
return ParsedActivity(
|
||||
points=points,
|
||||
sport=sport,
|
||||
sub_sport=sub_sport,
|
||||
started_at=points[0].timestamp,
|
||||
source_file=path.name,
|
||||
source_hash="",
|
||||
|
||||
Reference in New Issue
Block a user