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 CHANGED
@@ -1,10 +1,7 @@
1
- 0.4.5 - May 11th, 2009
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
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 5
3
- :major: 0
4
2
  :minor: 4
3
+ :patch: 6
4
+ :major: 0
@@ -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
- trackpoints.reverse_each do |tp|
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
@@ -26,6 +26,7 @@ module Importer
26
26
  workout.calc_average_hr!
27
27
  workout.calc_altitude_gain!
28
28
  workout.calc_average_speed!
29
+ workout.set_distance_from_trackpoints!
29
30
 
30
31
  return workout
31
32
  end
@@ -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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teich-hrmparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oren Teich