Remove useless recursion in DeckManager.rem

For any deck the children of it's children are its children. So
applying rem to children of children is useless and actually slightly
costly for deep subdecks
This commit is contained in:
Arthur Milchior 2020-04-05 11:32:51 +02:00
parent 1834b65714
commit c837143d31

View file

@ -150,13 +150,13 @@ class DeckManager:
self.col.sched.emptyDyn(did)
if childrenToo:
for name, id in self.children(did):
self.rem(id, cardsToo)
self.rem(id, cardsToo, childrenToo=False)
else:
# delete children first
if childrenToo:
# we don't want to delete children when syncing
for name, id in self.children(did):
self.rem(id, cardsToo)
self.rem(id, cardsToo, childrenToo=False)
# delete cards too?
if cardsToo:
# don't use cids(), as we want cards in cram decks too