teich-hrmparser 0.2.2 → 0.3.0

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 ADDED
@@ -0,0 +1,2 @@
1
+ 0.2.3
2
+ Now should keep lat and lng set to nil when they don't exist in garmin files.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
+ :patch: 0
2
3
  :major: 0
3
- :minor: 2
4
- :patch: 2
4
+ :minor: 3
@@ -26,11 +26,16 @@ module Importer
26
26
  trackpoint = HRMParser::TrackPoint.new
27
27
  next if ((t/:HeartRateBpm/:Value).innerHTML == "")
28
28
  trackpoint.hr = (t/:HeartRateBpm/:Value).innerHTML.to_i
29
- trackpoint.lat = (t/:Position/:LatitudeDegrees).innerHTML.to_f
30
- trackpoint.lng = (t/:Position/:LongitudeDegrees).innerHTML.to_f
31
29
  trackpoint.time = Time.parse((t/:Time).innerHTML)
32
30
  trackpoint.altitude = (t/:AltitudeMeters).innerHTML.to_f
33
31
  trackpoint.distance = (t/:DistanceMeters).innerHTML.to_f
32
+
33
+ (t/:Position).each do |p|
34
+ trackpoint.lat = (p/:LatitudeDegrees).innerHTML.to_f
35
+ trackpoint.lng = (p/:LongitudeDegrees).innerHTML.to_f
36
+ end
37
+
38
+
34
39
  trackpoints << trackpoint
35
40
 
36
41
 
@@ -72,14 +72,14 @@ module HRMParser
72
72
  data = File.read(filename)
73
73
  importer = Importer::Garmin.new(:data => data)
74
74
  workout = importer.restore
75
- workout.distance.should == nil
76
- workout.average_hr.should == nil
77
- workout.average_speed.should == nil
78
- workout.altitude_gain.should == nil
79
- workout.trackpoints == nil
75
+ workout.distance.should be_nil
76
+ workout.average_hr.should be_nil
77
+ workout.average_speed.should be_nil
78
+ workout.altitude_gain.should be_nil
79
+ workout.trackpoints.should == {}
80
80
  end
81
81
 
82
- ## Parsing the full XML is just slow. Commenting out for now.
82
+ # Parsing the full XML is just slow. Commenting out for now.
83
83
  it "gets workout level settings for outdoor workout" do
84
84
  filename = "spec/samples/outdoor-garmin-405.TCX"
85
85
  data = File.read(filename)
@@ -90,6 +90,14 @@ module HRMParser
90
90
  workout.average_speed.should be_close(1.5, 0.2)
91
91
  workout.altitude_gain.should be_close(572, 1.0)
92
92
  end
93
+
94
+ it "doesn't have any 0 in latitude" do
95
+ filename = "spec/samples/garmin-405-with-0-0.TCX"
96
+ data = File.read(filename)
97
+ importer = Importer::Garmin.new(:data => data)
98
+ workout = importer.restore
99
+ workout.trackpoints.map {|tp| tp.lat.should_not == 0.0}
100
+ end
93
101
  end
94
102
 
95
103
  context "Parse polar RS200 file" do
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.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oren Teich
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-29 00:00:00 -07:00
12
+ date: 2009-05-05 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,6 +22,7 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.rdoc
24
24
  files:
25
+ - CHANGELOG.txt
25
26
  - README.rdoc
26
27
  - Rakefile
27
28
  - VERSION.yml