teich-hrmparser 0.4.6 → 0.4.7

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/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 4
3
- :patch: 6
3
+ :patch: 7
4
4
  :major: 0
@@ -79,9 +79,17 @@ module Importer
79
79
  points_f = %w[epoc kcal speed]
80
80
  points_i = %w[altitude hr respiration ventilation vo2 distance cadence temp]
81
81
 
82
- points_f.each { |p| trackpoint.send("#{p}=".to_sym, (eval p).to_f) }
83
- points_i.each { |p| trackpoint.send("#{p}=".to_sym, (eval p).to_i) }
84
-
82
+ points_f.each do |p|
83
+ value = (eval p).to_f
84
+ value = nil if value == 0.0
85
+ trackpoint.send("#{p}=".to_sym, value)
86
+ end
87
+
88
+ points_i.each do |p|
89
+ value = (eval p).to_i
90
+ value = nil if value == 0
91
+ trackpoint.send("#{p}=".to_sym, value)
92
+ end
85
93
  dt = DateTime.strptime(date + " " + time, "%d.%m.%Y %H:%M.%S")
86
94
  time_for_parse = dt.strftime("%b %d %H:%M:%S @time_zone %Y")
87
95
  trackpoint.time = Time.parse(time_for_parse)
@@ -27,7 +27,7 @@ module HRMParser
27
27
 
28
28
  def calc_altitude_gain!
29
29
  gain = 0
30
- smoothed_altitude = altitudes.smoothed(10)
30
+ smoothed_altitude = altitudes.compact.smoothed(10)
31
31
  start = smoothed_altitude.first
32
32
  smoothed_altitude.each do |alt|
33
33
  diff = alt - start
@@ -109,7 +109,7 @@ module HRMParser
109
109
  workout.distance.should be_close(11740, 5)
110
110
  workout.average_hr.should be_close(149.7, 0.5)
111
111
  workout.average_speed.should be_close(1.5, 0.2)
112
- workout.altitude_gain.should be_close(583, 1.0)
112
+ workout.altitude_gain.should be_close(580, 25)
113
113
  end
114
114
 
115
115
  it "gets workout level settings for weird distance workout" do
@@ -120,7 +120,7 @@ module HRMParser
120
120
  workout.distance.should be_close(9426, 1)
121
121
  workout.average_hr.should == nil
122
122
  workout.average_speed.should be_close(6.7, 0.2)
123
- workout.altitude_gain.should be_close(40, 1.0)
123
+ workout.altitude_gain.should be_close(40, 10)
124
124
  end
125
125
 
126
126
  it "doesn't have any 0 in latitude" do
@@ -178,7 +178,8 @@ module HRMParser
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
+ workout.trackpoints.each { |tp| tp.speed.should == nil }
182
+ workout.altitude_gain.should be_close(115, 10)
182
183
  end
183
184
  it "calculates the speed and distance" do
184
185
  filename = "spec/samples/suunto-with-cadence-speed-distance.sdf"
@@ -186,8 +187,8 @@ module HRMParser
186
187
  importer = Importer::Suunto.new(:data => data, :time_zone => "Pacific Time (US & Canada)")
187
188
  workout = importer.restore
188
189
  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)
190
+ workout.average_speed.should be_close(9.3, 0.1)
191
+ workout.altitude_gain.should be_close(70, 10)
191
192
  workout.distance.should == 124597
192
193
  end
193
194
 
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.6
4
+ version: 0.4.7
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-11 00:00:00 -07:00
12
+ date: 2009-05-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15