File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,8 @@ def parse_tracks(lap)
109
109
heart_rate : trackpoint . xpath ( 'xmlns:HeartRateBpm/xmlns:Value' ) . text . to_i ,
110
110
cadence : trackpoint . xpath ( 'xmlns:Cadence' ) . text . to_i ,
111
111
sensor_state : trackpoint . xpath ( 'xmlns:SensorState' ) . text ,
112
- watts : trackpoint . xpath ( 'xmlns:Extensions/ns3:TPX/ns3:Watts' ) . text . to_f
112
+ watts : trackpoint . xpath ( 'xmlns:Extensions/ns3:TPX/ns3:Watts' ) . text . to_f ,
113
+ speed : trackpoint . xpath ( 'xmlns:Extensions/ns3:TPX/ns3:Speed' ) . text . to_f
113
114
}
114
115
end
115
116
tracks << trackpoints
@@ -276,9 +277,7 @@ def calculate_average_speed_from_activities(activities)
276
277
activities . each do |activity |
277
278
activity [ :laps ] . each do |lap |
278
279
lap [ :tracks ] . flatten . each do |trackpoint |
279
- distance = trackpoint [ :distance_meters ]
280
- time_seconds = lap [ :total_time_seconds ]
281
- speed = distance / time_seconds if time_seconds > 0
280
+ speed = trackpoint [ :speed ]
282
281
283
282
if speed
284
283
total_speed_all += speed
You can’t perform that action at this time.
0 commit comments