mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
hide the default deck if it's empty and there are other decks
This commit is contained in:
parent
bbbff0ca32
commit
125518a9ed
1 changed files with 6 additions and 2 deletions
|
@ -171,13 +171,17 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
|
||||||
else:
|
else:
|
||||||
buf = ""
|
buf = ""
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
buf += self._deckRow(node, depth)
|
buf += self._deckRow(node, depth, len(nodes))
|
||||||
if depth == 0:
|
if depth == 0:
|
||||||
buf += self._topLevelDragRow()
|
buf += self._topLevelDragRow()
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
def _deckRow(self, node, depth):
|
def _deckRow(self, node, depth, cnt):
|
||||||
name, did, due, lrn, new, children = node
|
name, did, due, lrn, new, children = node
|
||||||
|
if did == 1 and cnt > 1 and not children:
|
||||||
|
# if the default deck is empty, hide it
|
||||||
|
if not self.mw.col.db.scalar("select 1 from cards where did = 1"):
|
||||||
|
return ""
|
||||||
# parent toggled for collapsing
|
# parent toggled for collapsing
|
||||||
for parent in self.mw.col.decks.parents(did):
|
for parent in self.mw.col.decks.parents(did):
|
||||||
if parent['collapsed']:
|
if parent['collapsed']:
|
||||||
|
|
Loading…
Reference in a new issue