teich-hrmparser 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.txt +1 -4
- data/VERSION.yml +2 -2
- data/lib/hrmparser/importer/garmin.rb +1 -8
- data/lib/hrmparser/importer/suunto.rb +1 -0
- data/lib/hrmparser/workout.rb +9 -0
- data/spec/hrmparser_spec.rb +12 -0
- metadata +1 -1
data/CHANGELOG.txt
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.6 - May 11th, 2009
|
|
2
2
|
Added support for Suunto full variables including speed, distance, etc.
|
|
3
3
|
|
|
4
4
|
0.4.4 - May 10th, 2009
|
|
5
|
-
Fixed time-zone in trackpoints now
|
|
6
|
-
|
|
7
|
-
0.4.3 - May 10th, 2009
|
|
8
5
|
Fixed time-zone offset in parsing suunto data.
|
|
9
6
|
|
|
10
7
|
0.4.2 - May 9th, 2009
|
data/VERSION.yml
CHANGED
|
@@ -68,14 +68,7 @@ module Importer
|
|
|
68
68
|
workout.calc_average_speed!
|
|
69
69
|
workout.calc_altitude_gain!
|
|
70
70
|
workout.calc_average_hr!
|
|
71
|
-
|
|
72
|
-
if !tp.distance.nil?
|
|
73
|
-
workout.distance = tp.distance
|
|
74
|
-
break
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
# workout.distance = trackpoints.last.distance if !trackpoints.last.nil? && !trackpoints.last.distance.nil?
|
|
78
|
-
|
|
71
|
+
workout.set_distance_from_trackpoints!
|
|
79
72
|
end
|
|
80
73
|
|
|
81
74
|
return workout
|
data/lib/hrmparser/workout.rb
CHANGED
|
@@ -53,5 +53,14 @@ module HRMParser
|
|
|
53
53
|
def altitudes
|
|
54
54
|
@trackpoints.map { |tp| tp.altitude }
|
|
55
55
|
end
|
|
56
|
+
|
|
57
|
+
def set_distance_from_trackpoints!
|
|
58
|
+
@trackpoints.reverse_each do |tp|
|
|
59
|
+
if !tp.distance.nil?
|
|
60
|
+
self.distance = tp.distance
|
|
61
|
+
break
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
56
65
|
end
|
|
57
66
|
end
|
data/spec/hrmparser_spec.rb
CHANGED
|
@@ -180,6 +180,18 @@ module HRMParser
|
|
|
180
180
|
workout.average_speed.should == nil
|
|
181
181
|
workout.altitude_gain.should be_close(115, 1)
|
|
182
182
|
end
|
|
183
|
+
it "calculates the speed and distance" do
|
|
184
|
+
filename = "spec/samples/suunto-with-cadence-speed-distance.sdf"
|
|
185
|
+
data = File.read(filename)
|
|
186
|
+
importer = Importer::Suunto.new(:data => data, :time_zone => "Pacific Time (US & Canada)")
|
|
187
|
+
workout = importer.restore
|
|
188
|
+
workout.average_hr.should be_close(131,1)
|
|
189
|
+
workout.average_speed.should be_close(9.2,0.2)
|
|
190
|
+
workout.altitude_gain.should be_close(68.3, 0.2)
|
|
191
|
+
workout.distance.should == 124597
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
|
|
183
195
|
end
|
|
184
196
|
end
|
|
185
197
|
end
|