another many decks speedup

This commit is contained in:
Damien Elmes 2018-05-31 16:24:34 +10:00
parent c207c9bc8c
commit 0052c8044c

View File

@ -133,13 +133,14 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
buf += self._topLevelDragRow()
else:
buf = ""
nameMap = self.mw.col.decks.nameMap()
for node in nodes:
buf += self._deckRow(node, depth, len(nodes))
buf += self._deckRow(node, depth, len(nodes), nameMap)
if depth == 0:
buf += self._topLevelDragRow()
return buf
def _deckRow(self, node, depth, cnt):
def _deckRow(self, node, depth, cnt, nameMap):
name, did, due, lrn, new, children = node
deck = self.mw.col.decks.get(did)
if did == 1 and cnt > 1 and not children:
@ -147,7 +148,7 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
if not self.mw.col.db.scalar("select 1 from cards where did = 1"):
return ""
# parent toggled for collapsing
for parent in self.mw.col.decks.parents(did):
for parent in self.mw.col.decks.parents(did, nameMap):
if parent['collapsed']:
buff = ""
return buff