summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2016-01-30 20:40:19 +0100
committerChris Schlaeger <chris@linux.com>2016-01-30 20:40:19 +0100
commit6c2e9624364af2713a54b2e8655e954206271ec9 (patch)
treeaeefa67e219deb607dce54639033cc0db4f0f7c9 /lib
parent678cf8a5cb8ec0903871b32507407ebf918087a2 (diff)
downloadpostrunner-6c2e9624364af2713a54b2e8655e954206271ec9.zip
NEW: Activities can now have an attached note.
Use this to capture any additional information about the activity as free text. It will be shown in the summary report.
Diffstat (limited to 'lib')
-rw-r--r--lib/postrunner/ActivitySummary.rb13
-rw-r--r--lib/postrunner/FFS_Activity.rb7
-rw-r--r--lib/postrunner/Main.rb1
3 files changed, 18 insertions, 3 deletions
diff --git a/lib/postrunner/ActivitySummary.rb b/lib/postrunner/ActivitySummary.rb
index 89778ea..9caa9dd 100644
--- a/lib/postrunner/ActivitySummary.rb
+++ b/lib/postrunner/ActivitySummary.rb
@@ -33,17 +33,28 @@ module PostRunner
end
def to_s
- summary.to_s + "\n" + laps.to_s
+ summary.to_s + "\n" +
+ (@activity.note ? note.to_s + "\n" : '') +
+ laps.to_s
end
def to_html(doc)
width = 600
ViewFrame.new("Activity: #{@name}", width, summary).to_html(doc)
+ ViewFrame.new('Note', width, note).to_html(doc) if @activity.note
ViewFrame.new('Laps', width, laps).to_html(doc)
end
private
+ def note
+ t = FlexiTable.new
+ t.enable_frame(false)
+ t.body
+ t.row([ @activity.note ])
+ t
+ end
+
def summary
session = @fit_activity.sessions[0]
diff --git a/lib/postrunner/FFS_Activity.rb b/lib/postrunner/FFS_Activity.rb
index 3921301..27efea0 100644
--- a/lib/postrunner/FFS_Activity.rb
+++ b/lib/postrunner/FFS_Activity.rb
@@ -96,8 +96,9 @@ module PostRunner
'all' => 'All'
}
- po_attr :device, :fit_file_name, :norecord, :name, :sport, :sub_sport,
- :timestamp, :total_distance, :total_timer_time, :avg_speed
+ po_attr :device, :fit_file_name, :norecord, :name, :note, :sport,
+ :sub_sport, :timestamp, :total_distance, :total_timer_time,
+ :avg_speed
attr_reader :fit_activity
# Create a new FFS_Activity object.
@@ -209,6 +210,8 @@ module PostRunner
case attribute
when 'name'
self.name = value
+ when 'note'
+ self.note = value
when 'type'
load_fit_file
unless ActivityTypes.values.include?(value)
diff --git a/lib/postrunner/Main.rb b/lib/postrunner/Main.rb
index 1bb067a..baf6a3e 100644
--- a/lib/postrunner/Main.rb
+++ b/lib/postrunner/Main.rb
@@ -178,6 +178,7 @@ set <attribute> <value> <ref>
name: The activity name (defaults to FIT file name)
norecord: Ignore all records from this activity (value must true
or false)
+ note: A comment or summary of the activity
type: The type of the activity
subtype: The subtype of the activity