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

Settlement: deprecate notes migration #49

Open toconnell opened 3 years ago

toconnell commented 3 years ago

These warnings are chewing up a bunch of logs: we need a cut-off, after which we don't check old settlement notes.

image

toconnell commented 3 years ago

Phase one of deprecating this is only calling it when we're processing a legacy settlement:

@@ -352,7 +368,9 @@ class Settlement(models.UserAsset):

         self.bug_fixes()
         self.baseline()
-        self.migrate_settlement_notes()
+
+        if self.settlement.get("settlement_notes", None) is not None:
+            self.migrate_settlement_notes()

         #
@@ -4474,6 +4492,8 @@ class Settlement(models.UserAsset):
         as a proper settlement_note document in mdb. """

         if self.settlement.get("settlement_notes", None) is None:
+            err = "%s Does not have 'settlement_notes' key! Cannot migrate..."
+            self.logger.warn(err % self)
             return True
         else:
             self.logger.debug("Converting legacy 'settlement_notes' to mdb.settlement_notes doc!")