tcgoetz / GarminDB

Download and parse data from Garmin Connect or a Garmin watch, FitBit CSV, and MS Health CSV files into and analyze data in Sqlite serverless databases with Jupyter notebooks.
GNU General Public License v2.0
1.18k stars 142 forks source link

Fix activity name parsing for custom made activities (garmin instinct) #101

Closed kg005 closed 3 years ago

kg005 commented 3 years ago

Custom made activities (I use such for custom workouts like WHM breathing and cold showers) miss their name in the DB - which makes them indistinguishable from each other if you do not now exact IDs.

Using logs I found that sport here is None and thus there is an error calling sport.name and the activity does not get parsed and its name is not updated.

The issue is caused here since for custom made activities have following representation in JSON (at least using garmin instinct):

"activityType": {
    "typeId": 4,
    "typeKey": "other",
    "parentTypeId": 17, ...
}

so their sport will be 17 -> Top level and subsport is 4 -> other and other is not in the remap_gc_sport_to_fit dict.

Adding other fixes it and allows correct parsing.

tcgoetz commented 3 years ago

Please retarget this PR against the develop branch and I will merge it.

tcgoetz commented 3 years ago

Manually resolved with commit dd9cc54a106b0a613516afbbfa0532adc9047bf1