scrapper / postrunner

Application to manage FIT files such as those produced by Garmin fitness devices
GNU General Public License v2.0
62 stars 14 forks source link

Postrunner 0.7.5 can't read my existing data after upgrade #7

Closed paulibaadsager closed 7 years ago

paulibaadsager commented 7 years ago

After upgrading postrunner from 0.6.0 to 0.7.5, I get this error when running

$ postrunner list
INFO: Converting BTreeDB based database to FlatFileDB format
ERROR: undefined method `class_to_id' for nil:NilClass
/home/pauli/.gem/ruby/2.4.0/gems/perobs-2.4.1/lib/perobs/ObjectBase.rb:187:in `_sync'
/home/pauli/.gem/ruby/2.4.0/gems/perobs-2.4.1/lib/perobs/Cache.rb:115:in `block in flush'
/home/pauli/.gem/ruby/2.4.0/gems/perobs-2.4.1/lib/perobs/Cache.rb:115:in `each'
/home/pauli/.gem/ruby/2.4.0/gems/perobs-2.4.1/lib/perobs/Cache.rb:115:in `flush'
/home/pauli/.gem/ruby/2.4.0/gems/perobs-2.4.1/lib/perobs/Store.rb:196:in `exit'
/home/pauli/.gem/ruby/2.4.0/gems/postrunner-0.7.5/lib/postrunner/Main.rb:643:in `ensure_flat_file_db'
/home/pauli/.gem/ruby/2.4.0/gems/postrunner-0.7.5/lib/postrunner/Main.rb:58:in `main'
/home/pauli/.gem/ruby/2.4.0/gems/postrunner-0.7.5/lib/postrunner.rb:24:in `<module:PostRunner>'
/home/pauli/.gem/ruby/2.4.0/gems/postrunner-0.7.5/lib/postrunner.rb:22:in `<top (required)>'
/usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/pauli/.gem/ruby/2.4.0/gems/postrunner-0.7.5/bin/postrunner:4:in `<top (required)>'
/home/pauli/.gem/ruby/2.3.0/bin/postrunner:23:in `load'
/home/pauli/.gem/ruby/2.3.0/bin/postrunner:23:in `<main>'

*******************************************************************************
You have triggered a bug in PostRunner 0.7.5!

If I remove the existing .postrunner directory and try again I get this

$ postrunner list
INFO: Creating PostRunner data directory /home/pauli/.postrunner
INFO: Creating HTML output directory /home/pauli/.postrunner/html
INFO: Creating devices directory /home/pauli/.postrunner/devices
INFO: Creating Old Fit directory /home/pauli/.postrunner/old_fit_dir
INFO: Creating fit directory /home/pauli/.postrunner/fit
+----+--------+----+-----+--------+--------+----------+
|Ref.|Activity|Type|Start|Distance|Duration|Speed/Pace|
+----+--------+----+-----+--------+--------+----------+

So it seems like postrunner 0.7.5 can't read the existing database. I would like postrunner to read the existing data, but I don't know what causes this problem.

My ruby gem versions are: fit4ruby (1.5.1, 1.3.0) perobs (2.4.1, 2.3.1) postrunner (0.7.5, 0.6.0)

The existing data are obtained with Garmin Forerunner 610 and Fenix 3HR.

scrapper commented 7 years ago

Updates from older versions should work fine as the storage format has changed a few times during the history of postrunner. Looks like you have a problem during the conversion to the most recent format. Interestingly, the problem seems to be with the old database, not the newly created one. You can try to do the following steps:

  1. Copy your ~/.postrunner directory and store it away safely. You may have to come back to this.
  2. If you don't mind making it available to me, I can try to debug this for you.
  3. If the conversion was successful, you could try to rename database to database-old and database-new to database. Then run 'postrunner check' to see if the new database is OK.
  4. If that doesn't work, uninstall the new version and run a 'postrunner check' on the old database to see if it's OK.

If that doesn't work, more debugging is needed.

paulibaadsager commented 7 years ago

After I renamed from database to database-old and from database-new to database, everything is working fine, and postrunner reads all my existing data. Thank you!