mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -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]
|
parts = parts[:-1]
|
||||||
return "::".join(parts)
|
return "::".join(parts)
|
||||||
for deck in decks:
|
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'])
|
p = parent(deck['name'])
|
||||||
# new
|
# new
|
||||||
nlim = self._deckNewLimitSingle(deck)
|
nlim = self._deckNewLimitSingle(deck)
|
||||||
if p:
|
if p:
|
||||||
# if parent was missing, add and restart
|
|
||||||
if p not in lims:
|
if p not in lims:
|
||||||
deck['name'] = self.col.decks._ensureParents(deck['name'])
|
# if parent was missing, this deck is invalid, and we
|
||||||
self.col.decks.save(deck)
|
# need to reload the deck list
|
||||||
|
self.col.decks.rem(deck['id'], cardsToo=False, childrenToo=True)
|
||||||
return self.deckDueList()
|
return self.deckDueList()
|
||||||
nlim = min(nlim, lims[p][0])
|
nlim = min(nlim, lims[p][0])
|
||||||
new = self._newForDeck(deck['id'], nlim)
|
new = self._newForDeck(deck['id'], nlim)
|
||||||
|
|
Loading…
Reference in a new issue