aussig / BGS-Tally

A tool to track and report your Background Simulation (BGS) and Thargoid War (TW) activity in Elite Dangerous, implemented as an EDMC plugin. BGS Tally counts all the work you do for any faction, in any system.
https://discord.gg/YDNVtjPnnm
MIT License
30 stars 9 forks source link

activitymanager error (due to no data ?) #100

Closed Athanasius closed 1 year ago

Athanasius commented 1 year ago

Describe the bug

  File "C:\Users\Athan\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\activitymanager.py", line 42, in save
    activity.save(path.join(self.bgstally.plugin_dir, FOLDER_ACTIVITYDATA, activity.tick_id + FILE_SUFFIX))
                                                                           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

To Reproduce Steps to reproduce the behavior:

  1. I've not actually been playing, so have zero data any time recently.
  2. Run EDMC with BGS-Tally
  3. See error on console.

Expected behavior No errors.

Desktop (please complete the following information):

Additional context I'd guess that activity.tick_id is None, so you need a check on that before invoking this code, possibly more of it above too.

aussig commented 1 year ago

Could I get a little more context:

  1. Had you just upgraded to the 2.2.1 codebase, and if so do you recall what version you previously ran?
  2. Does the 'Previous BGS Tallies' dropdown have anything in it?
  3. What happens if you click the 'Latest BGS Tally' button - any exceptions thrown?
Athanasius commented 1 year ago
  1. From the 2.2.0 tag

  2. Yes, lots. The most recent right now is from 2023-01-10, there are more than just this, but the image shows I have gaps. image

  3. No exceptions

Nor did I get the 'original' exception this time. Possibly because that first run of 2.2.1 left some data behind that avoids it ?

aussig commented 1 year ago

It's strange it's managed to get set up with an activity record associated with a tick that doesn't have a TickID. That shouldn't really be possible, and I'm not sure whether this is the activity report for the current tick or a previous one.

I should have asked were there any other exceptions thrown, before the one you reported, on the first run. Do you still have the EDMC debug log to hand from that earlier run?

Athanasius commented 1 year ago

No, no other BGS-Tally exceptions. Although here's the full version of it:

2023-01-12 14:39:19.994 UTC - ERROR - 21164:24668:24668 plug.notify_journal_entry:319: Plugin "BGS-Tally" failed
Traceback (most recent call last):
  File "C:\Users\Athan\Documents\Devel\EDMarketConnector\plug.py", line 316, in notify_journal_entry
    newerror = journal_entry(cmdr, is_beta, system, station, dict(entry), dict(state))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Athan\AppData\Local\EDMarketConnector\plugins\BGS-Tally\load.py", line 59, in journal_entry
    this.journal_entry(cmdr, is_beta, system, station, entry, state)
  File "C:\Users\Athan\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\bgstally.py", line 167, in journal_entry
    if dirty: self.save_data()
              ^^^^^^^^^^^^^^^^
  File "C:\Users\Athan\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\bgstally.py", line 231, in save_data
    self.activity_manager.save()
  File "C:\Users\Athan\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\activitymanager.py", line 42, in save
    activity.save(path.join(self.bgstally.plugin_dir, FOLDER_ACTIVITYDATA, activity.tick_id + FILE_SUFFIX))
                                                                           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
aussig commented 1 year ago

Thanks Ath, I'll try to work out how it got into a 'no tick ID' situation, and as a last resort also put some error-detection in place as you suggest.