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 +2 -0
- data/VERSION.yml +2 -2
- data/lib/hrmparser/importer/garmin.rb +7 -2
- data/spec/hrmparser_spec.rb +14 -6
- metadata +3 -2
data/CHANGELOG.txt
ADDED
data/VERSION.yml
CHANGED
|
@@ -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
|
|
data/spec/hrmparser_spec.rb
CHANGED
|
@@ -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
|
|
76
|
-
workout.average_hr.should
|
|
77
|
-
workout.average_speed.should
|
|
78
|
-
workout.altitude_gain.should
|
|
79
|
-
workout.trackpoints ==
|
|
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
|
-
|
|
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.
|
|
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-
|
|
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
|