summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2018-01-17 08:24:22 +0100
committerChris Schlaeger <chris@linux.com>2018-01-17 08:24:22 +0100
commitb6a9cf173367a438681a86df710a6c1acbe9e3f7 (patch)
tree246a6e6d9385a171049845130914c023265d7d29
parentf370ea6a34bdd4d6d00fe8a3a238f26768917289 (diff)
downloadpostrunner-b6a9cf173367a438681a86df710a6c1acbe9e3f7.zip
Fix: Don't use a symbol to store the unit system
Recent versions of PEROBS don't support this anymore.
-rw-r--r--lib/postrunner/ActivityListView.rb2
-rw-r--r--lib/postrunner/FFS_Activity.rb8
-rw-r--r--lib/postrunner/Main.rb6
-rw-r--r--lib/postrunner/RecordListPageView.rb2
-rw-r--r--spec/spec_helper.rb2
5 files changed, 10 insertions, 10 deletions
diff --git a/lib/postrunner/ActivityListView.rb b/lib/postrunner/ActivityListView.rb
index b9c7d39..3ac93f0 100644
--- a/lib/postrunner/ActivityListView.rb
+++ b/lib/postrunner/ActivityListView.rb
@@ -26,7 +26,7 @@ module PostRunner
def initialize(ffs)
@ffs = ffs
- @unit_system = @ffs.store['config']['unit_system']
+ @unit_system = @ffs.store['config']['unit_system'].to_sym
@page_size = 20
@page_no = -1
@last_page = (@ffs.activities.length - 1) / @page_size
diff --git a/lib/postrunner/FFS_Activity.rb b/lib/postrunner/FFS_Activity.rb
index 79a6150..4c66857 100644
--- a/lib/postrunner/FFS_Activity.rb
+++ b/lib/postrunner/FFS_Activity.rb
@@ -177,7 +177,7 @@ module PostRunner
def events
load_fit_file
- puts EventList.new(self, @store['config']['unit_system']).to_s
+ puts EventList.new(self, @store['config']['unit_system'].to_sym).to_s
end
def show
@@ -190,12 +190,12 @@ module PostRunner
def sources
load_fit_file
- puts DataSources.new(self, @store['config']['unit_system']).to_s
+ puts DataSources.new(self, @store['config']['unit_system'].to_sym).to_s
end
def summary
load_fit_file
- puts ActivitySummary.new(self, @store['config']['unit_system'],
+ puts ActivitySummary.new(self, @store['config']['unit_system'].to_sym,
{ :name => @name,
:type => activity_type,
:sub_type => activity_sub_type }).to_s
@@ -244,7 +244,7 @@ module PostRunner
def generate_html_report
load_fit_file
- ActivityView.new(self, @store['config']['unit_system'])
+ ActivityView.new(self, @store['config']['unit_system'].to_sym)
end
def activity_type
diff --git a/lib/postrunner/Main.rb b/lib/postrunner/Main.rb
index 286fef6..e988b4e 100644
--- a/lib/postrunner/Main.rb
+++ b/lib/postrunner/Main.rb
@@ -61,7 +61,7 @@ module PostRunner
# Create a hash to store configuration data in the store unless it
# exists already.
cfg = (@db['config'] ||= @db.new(PEROBS::Hash))
- cfg['unit_system'] ||= :metric
+ cfg['unit_system'] ||= 'metric'
cfg['version'] ||= VERSION
# First day of the week. 0 means Sunday, 1 Monday and so on.
cfg['week_start_day'] ||= 1
@@ -528,8 +528,8 @@ EOT
Log.error("You must specify 'metric' or 'statute' as unit system.")
end
- if @db['config']['unit_system'].to_s != args[0]
- @db['config']['unit_system'] = args[0].to_sym
+ if @db['config']['unit_system'] != args[0]
+ @db['config']['unit_system'] = args[0]
@ffs.change_unit_system
end
end
diff --git a/lib/postrunner/RecordListPageView.rb b/lib/postrunner/RecordListPageView.rb
index 8cd2497..7ca974a 100644
--- a/lib/postrunner/RecordListPageView.rb
+++ b/lib/postrunner/RecordListPageView.rb
@@ -33,7 +33,7 @@ module PostRunner
# @param page_count [Fixnum] Number of total pages
# @param page_index [Fixnum] Index of the page
def initialize(ffs, records, page_count, page_index)
- #@unit_system = ffs.store['config']['unit_system']
+ #@unit_system = ffs.store['config']['unit_system'].to_sym
@records = records
views = ffs.views
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b79fc8c..3af954f 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -56,7 +56,7 @@ def create_fit_file_store
store['config'] = store.new(PEROBS::Hash)
store['config']['data_dir'] = @work_dir
store['config']['html_dir'] = @html_dir
- store['config']['unit_system'] = :metric
+ store['config']['unit_system'] = 'metric'
@ffs = store['file_store'] = store.new(PostRunner::FitFileStore)
@records = store['records'] = store.new(PostRunner::PersonalRecords)
end