theLaborInVain / kdm-manager-api

The API used by https://kdm-manager.com and related Kingdom Death: Monster utilities.
Other
3 stars 0 forks source link

World: settlement_popularity_contest_campaigns() throws errors while refreshing. #81

Closed toconnell closed 6 months ago

toconnell commented 6 months ago

Inspired by #80

There is a problem in settlement_popularity_contest_campaigns() where it bombs the whole asset refresh out if it tries to process campaigns whose handle is NOT a handle (i.e. ancient, legacy app data that has never been baselined).

[2024-02-28 07:55:30] ERROR:    exception caught while refreshing 'settlement_popularity_contest_campaigns' asset!
[2024-02-28 07:55:30] ERROR:    local variable 'c_name' referenced before assignment
Traceback (most recent call last):
  File "/home/toconnell/kdm-manager-api/app/world/__init__.py", line 220, in refresh_asset
    self.update_asset_dict(asset_dict)
  File "/home/toconnell/kdm-manager-api/app/world/__init__.py", line 276, in update_asset_dict
    fresh_results = update_method()
  File "/home/toconnell/kdm-manager-api/app/world/__init__.py", line 1228, in settlement_popularity_contest_campaigns
    if c_name in list(popularity_contest.keys()):
UnboundLocalError: local variable 'c_name' referenced before assignment
toconnell commented 6 months ago

Fixed. We ignore invalid campaign "handles" (which are probably not handles) now.