diff options
author | Chris Schlaeger <chris@linux.com> | 2014-11-17 01:18:28 +0100 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-11-17 01:18:28 +0100 |
commit | a053e45fe0550305c6d84fe6a5af79a15df329e3 (patch) | |
tree | 18d4bcef491bfe74d0125a21ebe508e318b1a65f /lib | |
parent | fe7c20ba45d49c8d09d873e1bc6df026d4f260a1 (diff) | |
download | postrunner-a053e45fe0550305c6d84fe6a5af79a15df329e3.zip |
Add activity type to activity summary
Diffstat (limited to 'lib')
-rw-r--r-- | lib/postrunner/Activity.rb | 3 | ||||
-rw-r--r-- | lib/postrunner/ActivitySummary.rb | 8 | ||||
-rw-r--r-- | lib/postrunner/ActivityView.rb | 5 |
3 files changed, 10 insertions, 6 deletions
diff --git a/lib/postrunner/Activity.rb b/lib/postrunner/Activity.rb index 1c2213f..5f9d4fd 100644 --- a/lib/postrunner/Activity.rb +++ b/lib/postrunner/Activity.rb @@ -137,7 +137,8 @@ module PostRunner def summary @fit_activity = load_fit_file unless @fit_activity - puts ActivitySummary.new(@fit_activity, name, @db.cfg[:unit_system]).to_s + puts ActivitySummary.new(@fit_activity, @db.cfg[:unit_system], + { :name => @name, :type => activity_type }).to_s end def rename(name) diff --git a/lib/postrunner/ActivitySummary.rb b/lib/postrunner/ActivitySummary.rb index 57935b2..78c158f 100644 --- a/lib/postrunner/ActivitySummary.rb +++ b/lib/postrunner/ActivitySummary.rb @@ -22,9 +22,10 @@ module PostRunner include Fit4Ruby::Converters include ViewWidgets - def initialize(fit_activity, name, unit_system) + def initialize(fit_activity, unit_system, custom_fields) @fit_activity = fit_activity - @name = name + @name = custom_fields[:name] + @type = custom_fields[:type] @unit_system = unit_system end @@ -49,7 +50,8 @@ module PostRunner t = FlexiTable.new t.enable_frame(false) t.body - t.row([ 'Date:', session.timestamp]) + t.row([ 'Type:', @type ]) + t.row([ 'Date:', session.timestamp ]) t.row([ 'Distance:', local_value(session, 'total_distance', '%.2f %s', { :metric => 'km', :statute => 'mi'}) ]) diff --git a/lib/postrunner/ActivityView.rb b/lib/postrunner/ActivityView.rb index 790a0aa..b41e32d 100644 --- a/lib/postrunner/ActivityView.rb +++ b/lib/postrunner/ActivityView.rb @@ -42,8 +42,9 @@ module PostRunner private def generate_html(doc) - @report = ActivitySummary.new(@activity.fit_activity, @activity.name, - @unit_system) + @report = ActivitySummary.new(@activity.fit_activity, @unit_system, + { :name => @activity.name, + :type => @activity.activity_type }) @device_list = DeviceList.new(@activity.fit_activity) @user_profile = UserProfileView.new(@activity.fit_activity, @unit_system) @track_view = TrackView.new(@activity) |