CTHRU/Hitrava

[BUG] Error converting Open Water Swim activity

jimiend opened this issue · 1 comments

Describe the bug
./Hitrava.py -j motion.json
the command above extract all activity and convert many of them up to a certain point

Logs

dpacific@DPACIFIC-M-V63K Hitrava-5.1.1 % ./Hitrava.py -j output/HiTrack_20230731_144047.json --log_level DEBUG
2023-08-25 17:24:11,655 - INFO - main - Hitrava version 5.1.1 (build 2207.2501) started with arguments ['-j', 'output/HiTrack_20230731_144047.json', '--log_level', 'DEBUG']
2023-08-25 17:24:11,655 - INFO - main - Running on Python version 3.9.12
2023-08-25 17:24:11,657 - INFO - parse - Found one or more activities in JSON at index 0 to parse from 2023-07-31 (YYY-MM-DD)
2023-08-25 17:24:11,658 - INFO - _parse_activity - Saving activity from 2023-07-31 21:40:47 to HiTrack file ./output/HiTrack_20230731_144047 for parsing
2023-08-25 17:24:11,660 - INFO - parse - Parsing file <./output/HiTrack_20230731_144047>
2023-08-25 17:24:11,661 - DEBUG - __init__ - New HiTrack activity to process <HiTrack_20230731_144047>
snip
2023-08-25 17:24:11,749 - DEBUG - _close_file - HiTrack file <./output/HiTrack_20230731_144047> closed
2023-08-25 17:24:11,749 - INFO - set_activity_type - Setting activity type of activity HiTrack_20230731_144047 to Swim_Open_Water
2023-08-25 17:24:11,749 - INFO - set_pool_length - Setting pool length of activity HiTrack_20230731_144047 to 0
2023-08-25 17:24:11,749 - WARNING - set_pool_length - Pool length for activity HiTrack_20230731_144047 of type Swim_Open_Water will not be used. It is not a pool swimming activity
2023-08-25 17:24:11,749 - DEBUG - normalize_distances - Normalizing distance data for activity HiTrack_20230731_144047
Traceback (most recent call last):
  File "/Users/dpacific/expect/Hitrava-5.1.1/./Hitrava.py", line 2165, in <module>
    main()
  File "/Users/dpacific/expect/Hitrava-5.1.1/./Hitrava.py", line 2156, in main
    hi_activity.normalize_distances()
  File "/Users/dpacific/expect/Hitrava-5.1.1/./Hitrava.py", line 825, in normalize_distances
    segment['distance'] = segment['distance'] / normalize_ratio
KeyError: 'distance'
2023-08-25 17:24:11,758 - DEBUG - _close_json - JSON file <output/HiTrack_20230731_144047.json> closed

Files
Attaching the offending activity
Link removed

Additional Context
It is the first open water activity I try to convert

CTHRU commented

Thank you for reporting the issue. From the logs, it looks like we have an open water swim activity without distance information. I can't look into it now, but I will try to see if anything can be done about it within the next week.