summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2020-08-17 18:47:42 +0200
committerChris Schlaeger <chris@linux.com>2020-08-17 18:47:42 +0200
commitbe2ad2d0ae9f959677a4bfa25e80d398431d2464 (patch)
tree02f1ac7836b62869c7d05e27f7844a280d072ed6
parent7b142c605e1d859cfd63d42bcfbbef6fe9e45460 (diff)
downloadpostrunner-be2ad2d0ae9f959677a4bfa25e80d398431d2464.zip
Fix: Fix undefined local variable or method 'di' error
-rw-r--r--README.md2
-rw-r--r--lib/postrunner/FitFileStore.rb50
-rw-r--r--lib/postrunner/Main.rb1
3 files changed, 13 insertions, 40 deletions
diff --git a/README.md b/README.md
index 8613375..4c7e60d 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ other operating systems as well.
## Installation
PostRunner is a [http://www.ruby-lang.org](Ruby) application. You need
-to have a Ruby 2.0 or later runtime environment installed. This
+to have a Ruby 2.4 or later runtime environment installed. This
application was developed and tested on Linux but may work on other
operating systems as well. You can either install it as root for all
users on the computer or as a particular user for just this user.
diff --git a/lib/postrunner/FitFileStore.rb b/lib/postrunner/FitFileStore.rb
index f2e80b6..329fb69 100644
--- a/lib/postrunner/FitFileStore.rb
+++ b/lib/postrunner/FitFileStore.rb
@@ -502,46 +502,20 @@ module PostRunner
return nil
end
- if fid.manufacturer == 'garmin' &&
- fid.garmin_product == 'fr920xt'
- # Garmin Fenix3 with firmware before 6.80 is reporting 'fr920xt' in
- # the file_id section but 'fenix3' in the first device_info section.
- # To tell the Fenix3 apart from the FR920XT we need to look into the
- # device_info section for all devices with a garmin_product of
- # 'fr920xt'.
- fit_entity.device_infos.each do |di|
- if di.device_index == 0
- return {
- :manufacturer => di.manufacturer,
- :product => di.garmin_product || di.product,
- :numeric_manufacturer => di.numeric_manufacturer,
- :numeric_product => di.numeric_product,
- :serial_number => di.serial_number
- }
- end
+ fit_entity.device_infos.each do |di|
+ if di.device_index == 0
+ return {
+ :manufacturer => di.manufacturer,
+ :product => di.garmin_product || di.product,
+ :numeric_manufacturer => di.numeric_manufacturer,
+ :numeric_product => di.numeric_product,
+ :serial_number => di.serial_number || 0
+ }
end
- Log.error "Fit entity has no device info for 0"
- return nil
- else
- # And for all properly developed devices we can just look at the
- # file_id section.
- if fid.manufacturer.nil? ||
- fid.manufacturer[0..'Undocumented value'.length - 1] ==
- 'Undocumented value'
- Log.error "Cannot store FIT files for unknown manufacturer " +
- fid.manufacturer
- return nil
- end
- fid.serial_number ||= 0
-
- return {
- :manufacturer => fid.manufacturer,
- :product => fid.garmin_product || fid.product,
- :numeric_manufacturer => di.numeric_manufacturer,
- :numeric_product => di.numeric_product,
- :serial_number => fid.serial_number
- }
end
+
+ Log.error "Fit entity has no device info for 0"
+ return nil
end
def register_device(long_uid)
diff --git a/lib/postrunner/Main.rb b/lib/postrunner/Main.rb
index 6ad96ee..883d2ec 100644
--- a/lib/postrunner/Main.rb
+++ b/lib/postrunner/Main.rb
@@ -597,7 +597,6 @@ EOT
def handle_version_update
if @db['config']['version'] != VERSION
- puts "Work needed"
from_version = Gem::Version.new(@db['config']['version'])
to_version = Gem::Version.new(VERSION)