diff options
-rw-r--r-- | lib/postrunner/MonitoringDB.rb | 8 | ||||
-rw-r--r-- | lib/postrunner/version.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 5 |
3 files changed, 5 insertions, 10 deletions
diff --git a/lib/postrunner/MonitoringDB.rb b/lib/postrunner/MonitoringDB.rb index cc500bf..eeb8f87 100644 --- a/lib/postrunner/MonitoringDB.rb +++ b/lib/postrunner/MonitoringDB.rb @@ -10,27 +10,19 @@ # published by the Free Software Foundation. # -require 'postrunner/TimestampedObjectList' -require 'postrunner/MonitoringData' - module PostRunner class MonitoringDB def initialize(store, cfg) @store = store - @tol = TimestampedObjectList.new(@store, 'monitoring') end def add(fit_file_name, fit_monitoring_b) start_time = fit_monitoring_b.monitoring_infos[0].timestamp - data = MonitoringData.new(@store) - @tol.add_object(start_time, data) fit_monitoring_b.monitorings.each do |monitoring| if (cati = monitoring.current_activity_type_intensity) - data = MonitoringData.new(@store) - @tol.add_object(monitoring.timestamp, data) data.activity_type = decode_activity_type(cati & 0x1F) data.intensity = (cati >> 5) & 0x7 #puts "#{monitoring.timestamp}: #{decode_activity_type(cati & 0x1F)}" + diff --git a/lib/postrunner/version.rb b/lib/postrunner/version.rb index 60fcf13..2179ea3 100644 --- a/lib/postrunner/version.rb +++ b/lib/postrunner/version.rb @@ -11,5 +11,5 @@ # module PostRunner - VERSION = "0.0.9" + VERSION = "0.0.10" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3b7ea85..e91cffd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -35,6 +35,7 @@ def create_fit_activity(date, duration_minutes) :device_index => 0 }) a.new_device_info({ :timestamp => ts, :manufacturer => 'garmin', :device_index => 1, :battery_status => 'ok' }) + laps = 0 0.upto((a.total_timer_time / 60) - 1) do |mins| a.new_record({ :timestamp => ts, @@ -53,7 +54,9 @@ def create_fit_activity(date, duration_minutes) }) if mins > 0 && mins % 5 == 0 - a.new_lap({ :timestamp => ts, :sport => 'running' }) + a.new_lap({ :timestamp => ts, :sport => 'running', + :message_index => laps }) + laps += 1 end ts += 60 end |