mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
more robust deck list
- if we catch two decks with the same name, remove one and rebuild - instead of trying to ensure parents which may fail if an existing deck with a different case already exists, delete the deck that's missing parents
This commit is contained in:
parent
dd467cd413
commit
28e1cc933a
1 changed files with 8 additions and 3 deletions
|
@ -205,14 +205,19 @@ order by due""" % self._deckLimit(),
|
|||
parts = parts[:-1]
|
||||
return "::".join(parts)
|
||||
for deck in decks:
|
||||
# if we've already seen the exact same deck name, remove the
|
||||
# invalid duplicate and reload
|
||||
if deck['name'] in lims:
|
||||
self.col.decks.rem(deck['id'], cardsToo=False, childrenToo=True)
|
||||
return self.deckDueList()
|
||||
p = parent(deck['name'])
|
||||
# new
|
||||
nlim = self._deckNewLimitSingle(deck)
|
||||
if p:
|
||||
# if parent was missing, add and restart
|
||||
if p not in lims:
|
||||
deck['name'] = self.col.decks._ensureParents(deck['name'])
|
||||
self.col.decks.save(deck)
|
||||
# if parent was missing, this deck is invalid, and we
|
||||
# need to reload the deck list
|
||||
self.col.decks.rem(deck['id'], cardsToo=False, childrenToo=True)
|
||||
return self.deckDueList()
|
||||
nlim = min(nlim, lims[p][0])
|
||||
new = self._newForDeck(deck['id'], nlim)
|
||||
|
|
Loading…
Reference in a new issue