toconnell / kdm-manager

An interactive campaign manager for the game "Monster", by Kingdom Death. Development blog and release notes at https://blog.kdm-manager.com This project has no affiliation with Kingdom Death and is a totally independent, fan-maintained project.
http://kdm-manager.com
Other
26 stars 11 forks source link

Campaign Summary: changing survivor color scheme throws an error #531

Closed toconnell closed 5 years ago

toconnell commented 5 years ago

From email:

Settlement OID: 5d320d746515930ec8e7cac1

https://api.kdm-manager.com/survivor/set_color_scheme/5d3211736515930ec8e7cb52

when I change the color of the Survivor this comes up.

toconnell commented 5 years ago

I think this is probably just me not initializing the app/models/survivors/color_schemes.py module correctly.

toconnell commented 5 years ago
diff --git a/app/models/survivors/__init__.py b/app/models/survivors/__init__.py
index f3b64dd..02302a9 100644
--- a/app/models/survivors/__init__.py
+++ b/app/models/survivors/__init__.py
@@ -146,6 +146,7 @@ class Survivor(models.UserAsset):
         self.Disorders = disorders.Assets()
         self.Names = names.Assets()
         self.Saviors = saviors.Assets()
+        self.ColorSchemes = color_schemes.Assets()
         self.SpecialAttributes = special_attributes.Assets()
         self.WeaponProficiency = weapon_proficiency.Assets()

@@ -1142,7 +1143,7 @@ class Survivor(models.UserAsset):
         self.check_request_params(['handle'])
         handle = self.params['handle']
         self.survivor['color_scheme'] = handle
-        scheme_dict = color_schemes.get_asset(handle=handle)
+        scheme_dict = self.ColorSchemes.get_asset(handle=handle)
         self.log_event("%s set the color scheme to '%s' for %s." % (request.User.login, scheme_dict['name'], self.pretty_name()))
         self.save()