teich-hrmparser 0.4.3 → 0.4.4
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 +3 -0
- data/VERSION.yml +2 -2
- data/lib/hrmparser/importer/suunto.rb +10 -2
- data/lib/hrmparser/trackpoint.rb +1 -1
- data/spec/hrmparser_spec.rb +2 -1
- metadata +1 -1
data/CHANGELOG.txt
CHANGED
data/VERSION.yml
CHANGED
|
@@ -24,6 +24,8 @@ module Importer
|
|
|
24
24
|
workout.trackpoints = get_trackpoints
|
|
25
25
|
|
|
26
26
|
workout.calc_average_hr!
|
|
27
|
+
workout.calc_altitude_gain!
|
|
28
|
+
|
|
27
29
|
return workout
|
|
28
30
|
end
|
|
29
31
|
|
|
@@ -72,9 +74,15 @@ module Importer
|
|
|
72
74
|
|
|
73
75
|
trackpoint = HRMParser::TrackPoint.new
|
|
74
76
|
|
|
75
|
-
dt = DateTime.strptime(date + " " + time + " " + @time_zone, "%d.%m.%Y %H:%M.%S %Z")
|
|
76
|
-
|
|
77
|
+
#dt = DateTime.strptime(date + " " + time + " " + @time_zone, "%d.%m.%Y %H:%M.%S %Z")
|
|
78
|
+
|
|
79
|
+
dt = DateTime.strptime(date + " " + time, "%d.%m.%Y %H:%M.%S")
|
|
80
|
+
time_for_parse = dt.strftime("%b %d %H:%M:%S @time_zone %Y")
|
|
81
|
+
trackpoint.time = Time.parse(time_for_parse)
|
|
77
82
|
trackpoint.hr = hr.to_i
|
|
83
|
+
trackpoint.temp = temp.to_i
|
|
84
|
+
trackpoint.kcal = kcal.to_i
|
|
85
|
+
trackpoint.altitude = altitude.to_i
|
|
78
86
|
|
|
79
87
|
trackpoints << trackpoint
|
|
80
88
|
end
|
data/lib/hrmparser/trackpoint.rb
CHANGED
|
@@ -3,7 +3,7 @@ module HRMParser
|
|
|
3
3
|
|
|
4
4
|
RAD_PER_DEG = 0.017453293 # PI/180
|
|
5
5
|
|
|
6
|
-
attr_accessor :lat, :lng, :altitude, :speed, :hr, :distance, :time, :cadence
|
|
6
|
+
attr_accessor :lat, :lng, :altitude, :speed, :hr, :distance, :time, :cadence, :temp, :kcal
|
|
7
7
|
def initialize(opts = {:lat => nil, :lng => nil, :altitude => nil, :speed => nil, :hr => nil, :distance => nil, :cadence => nil, :time => Time.now})
|
|
8
8
|
@lat = opts[:lat]
|
|
9
9
|
@lng = opts[:lng]
|
data/spec/hrmparser_spec.rb
CHANGED
|
@@ -171,13 +171,14 @@ module HRMParser
|
|
|
171
171
|
workout.duration.should be_close(4781,1)
|
|
172
172
|
workout.time.should == Time.parse("Thu May 07 14:16:07 -0700 2009")
|
|
173
173
|
end
|
|
174
|
-
it "calculates the average HR" do
|
|
174
|
+
it "calculates the average HR & altitude" do
|
|
175
175
|
filename = "spec/samples/suunto-t6-RR-stops.sdf"
|
|
176
176
|
data = File.read(filename)
|
|
177
177
|
importer = Importer::Suunto.new(:data => data, :time_zone => "Pacific Time (US & Canada)")
|
|
178
178
|
workout = importer.restore
|
|
179
179
|
workout.average_hr.should be_close(152,1)
|
|
180
180
|
workout.average_speed.should == nil
|
|
181
|
+
workout.altitude_gain.should be_close(115, 1)
|
|
181
182
|
end
|
|
182
183
|
end
|
|
183
184
|
end
|