teich-hrmparser 0.4.2 → 0.4.3
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 +8 -2
- data/spec/hrmparser_spec.rb +10 -10
- metadata +2 -2
data/CHANGELOG.txt
CHANGED
data/VERSION.yml
CHANGED
|
@@ -11,8 +11,14 @@ module Importer
|
|
|
11
11
|
workout = HRMParser::Workout.new(:duration => 0)
|
|
12
12
|
|
|
13
13
|
params = parse_params("HEADER")
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
# Using DateTime because 1.8 at leas doesn't have a Time.strptime
|
|
16
|
+
# And european ordeirng consfuses time.parse
|
|
17
|
+
# TODO: must be some better way
|
|
18
|
+
dt = DateTime.strptime(params["STARTTIME"], "%d.%m.%Y %H:%M.%S")
|
|
19
|
+
time_for_parse = dt.strftime("%b %d %H:%M:%S @time_zone %Y")
|
|
20
|
+
|
|
21
|
+
workout.time = Time.parse(time_for_parse)
|
|
16
22
|
workout.duration = params["DURATION"].to_f
|
|
17
23
|
|
|
18
24
|
workout.trackpoints = get_trackpoints
|
data/spec/hrmparser_spec.rb
CHANGED
|
@@ -47,7 +47,7 @@ module HRMParser
|
|
|
47
47
|
type.should == nil
|
|
48
48
|
end
|
|
49
49
|
it "identify file as polar" do
|
|
50
|
-
type = Importer.file_type("spec/samples/
|
|
50
|
+
type = Importer.file_type("spec/samples/polarRS400.hrm")
|
|
51
51
|
type.should == "POLAR_HRM"
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -133,19 +133,19 @@ module HRMParser
|
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
-
context "Parse polar
|
|
136
|
+
context "Parse polar RS400 file" do
|
|
137
137
|
it "finds the duration and time" do
|
|
138
|
-
filename ="spec/samples/
|
|
138
|
+
filename ="spec/samples/polarRS400.hrm"
|
|
139
139
|
data = File.read(filename)
|
|
140
|
-
importer = Importer::Polar.new(:data => data, :time_zone => "
|
|
140
|
+
importer = Importer::Polar.new(:data => data, :time_zone => "Pacific Time (US & Canada)")
|
|
141
141
|
workout = importer.restore
|
|
142
142
|
workout.duration.should be_close(3569,1)
|
|
143
|
-
workout.time.should == Time.parse("Thu Apr 16 12:01:55
|
|
143
|
+
workout.time.should == Time.parse("Thu Apr 16 12:01:55 -0700 2009")
|
|
144
144
|
end
|
|
145
145
|
it "calculates the average heartrate" do
|
|
146
|
-
filename ="spec/samples/
|
|
146
|
+
filename ="spec/samples/polarRS400.hrm"
|
|
147
147
|
data = File.read(filename)
|
|
148
|
-
importer = Importer::Polar.new(:data => data, :time_zone => "
|
|
148
|
+
importer = Importer::Polar.new(:data => data, :time_zone => "Pacific Time (US & Canada)")
|
|
149
149
|
workout = importer.restore
|
|
150
150
|
workout.average_hr.should be_close(145, 1)
|
|
151
151
|
end
|
|
@@ -154,7 +154,7 @@ module HRMParser
|
|
|
154
154
|
it "calculates the heart rate from RR" do
|
|
155
155
|
filename ="spec/samples/polarRS800-RR.hrm"
|
|
156
156
|
data = File.read(filename)
|
|
157
|
-
importer = Importer::Polar.new(:data => data, :time_zone => "
|
|
157
|
+
importer = Importer::Polar.new(:data => data, :time_zone => "Pacific Time (US & Canada)")
|
|
158
158
|
workout = importer.restore
|
|
159
159
|
workout.trackpoints.each {|tp| tp.hr.should < 220 && tp.hr.should > 30}
|
|
160
160
|
workout.average_hr.should be_close(115, 1)
|
|
@@ -166,7 +166,7 @@ module HRMParser
|
|
|
166
166
|
it "finds the duration and time" do
|
|
167
167
|
filename = "spec/samples/suunto-t6-RR-stops.sdf"
|
|
168
168
|
data = File.read(filename)
|
|
169
|
-
importer = Importer::Suunto.new(:data => data, :time_zone => "
|
|
169
|
+
importer = Importer::Suunto.new(:data => data, :time_zone => "Pacific Time (US & Canada)")
|
|
170
170
|
workout = importer.restore
|
|
171
171
|
workout.duration.should be_close(4781,1)
|
|
172
172
|
workout.time.should == Time.parse("Thu May 07 14:16:07 -0700 2009")
|
|
@@ -174,7 +174,7 @@ module HRMParser
|
|
|
174
174
|
it "calculates the average HR" do
|
|
175
175
|
filename = "spec/samples/suunto-t6-RR-stops.sdf"
|
|
176
176
|
data = File.read(filename)
|
|
177
|
-
importer = Importer::Suunto.new(:data => data, :time_zone => "
|
|
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
|
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.
|
|
4
|
+
version: 0.4.3
|
|
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-05-
|
|
12
|
+
date: 2009-05-10 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|