put deck fix messages in the collection log

This commit is contained in:
Damien Elmes 2019-06-27 09:46:56 +10:00
parent 9fc4b55575
commit ce4d18aded

View File

@ -455,13 +455,13 @@ class DeckManager:
for deck in decks:
# two decks with the same name?
if deck['name'] in names:
print("fix duplicate deck name", deck['name'].encode("utf8"))
self.col.log("fix duplicate deck name", deck['name'])
deck['name'] += "%d" % intTime(1000)
self.save(deck)
# ensure no sections are blank
if not all(deck['name'].split("::")):
print("fix deck with missing sections", deck['name'].encode("utf8"))
self.col.log("fix deck with missing sections", deck['name'])
deck['name'] = "recovered%d" % intTime(1000)
self.save(deck)
@ -469,7 +469,7 @@ class DeckManager:
if "::" in deck['name']:
immediateParent = "::".join(deck['name'].split("::")[:-1])
if immediateParent not in names:
print("fix deck with missing parent", deck['name'].encode("utf8"))
self.col.log("fix deck with missing parent", deck['name'])
self._ensureParents(deck['name'])
names.add(immediateParent)