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 CHANGED
@@ -1,3 +1,6 @@
1
+ 0.4.4 - May 10th, 2009
2
+ Fixed time-zone in trackpoints now
3
+
1
4
  0.4.3 - May 10th, 2009
2
5
  Fixed time-zone offset in parsing suunto data.
3
6
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 4
3
- :patch: 3
4
2
  :major: 0
3
+ :minor: 4
4
+ :patch: 4
@@ -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
- trackpoint.time = Time.parse(dt.to_s)
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
@@ -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]
@@ -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
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.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oren Teich