cpfair / tapiriik

tapiriik keeps your fitness in sync
https://tapiriik.com
Apache License 2.0
1.72k stars 294 forks source link

Problem with activity type mapping VeloHero -> Strava #161

Open hkolkhorst opened 9 years ago

hkolkhorst commented 9 years ago

The sync from Velohero to Strava is not working: Activities are recognized, but not synced; the activities page shows the following error:

Jul 25, 2015 Other  

This activity was not synchronized to the following services:

    Strava: Strava does not support this type of activity. 

Since the activity type is set to "Other", I suppose the parsing of Velohero data is somewhat faulty

hkolkhorst commented 9 years ago

An example JSON excerpt from the activities page:

{
"workouts":[{
"id":"1392479",
"date_ymd":"2015-07-25",
"start_time":"10:34:00",
"dur_time":"01:07:25",
"dist_km":"13.800000","asc_m":"94.000000",
"dsc_m":"98.000000",
"alt_min_m":"220.000000",
"alt_max_m":"273.000000","spd_avg_kph":"12.880000",
"spd_max_kph":"30.030001","hr_avg_bpm":"",
"hr_max_bpm":"","cad_avg_rpm":"",
"cad_max_rpm":"","pwr_avg_w":"",
"pwr_max_w":"","borg_rpe":"5","sport_id":"2",
"sport_name":"Laufsport",
"type_id":"3972",
"type_name":"Frühstückslauf",
"route_id":"0",
"route_name":"","equipment_ids":["2118"],
"equipment_names":["Adrenaline GTS 13 B"],"weather_id":"",
"weather_name":"",
"temp_c":"",
"wind_bft":"","kcal":"942","file":"1",
"file_type":"TCX",
"workout_comment":"",
"hide":"",
"last_change":"2015-07-25T19:33:27"
}

My guess would be, that it's a type error in the reverse activity mappings: Velohero returns the sport_id as a string, but the keys in _reverseActivityMappings in https://github.com/cpfair/tapiriik/blob/master/tapiriik/services/VeloHero/velohero.py#L54 are integers. So the condition in https://github.com/cpfair/tapiriik/blob/master/tapiriik/services/VeloHero/velohero.py#L204 if workout["sport_id"] in self._reverseActivityMappings: is probably always false?

Hence my solution would be to make the keys in _reverseActivityMappings strings.

Cyclenerd commented 9 years ago

Thank you for the feedback. Error is corrected with https://github.com/cpfair/tapiriik/pull/164.