summaryrefslogtreecommitdiff
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
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.
-rw-r--r--README.md7
-rw-r--r--lib/postrunner/ActivitySummary.rb13
-rw-r--r--lib/postrunner/FFS_Activity.rb7
-rw-r--r--lib/postrunner/Main.rb1
4 files changed, 22 insertions, 6 deletions
diff --git a/README.md b/README.md
index 734ef45..9f9c0e9 100644
--- a/README.md
+++ b/README.md
@@ -32,12 +32,13 @@ full path to the directory that contains your FIT files. You can then
import all files on the device.
```
-$ postrunner import /var/run/media/user/GARMIN/GARMIN/ACTIVITY/
+$ postrunner import /run/media/$USER/GARMIN/GARMIN/ACTIVITY/
```
The above command assumes that your device is mounted as
-/var/run/media/user. Please replace this with the path to your device.
-Files that have been imported previously will not be imported again.
+/run/media/$USER. Please replace $USER with your login name and the
+path with the path to your device. Files that have been imported
+previously will not be imported again.
### Viewing FIT file data on the console
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