From 0052c8044c8911694cbc5de25a1bae1bac830a4d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 31 May 2018 16:24:34 +1000 Subject: [PATCH] another many decks speedup --- aqt/deckbrowser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aqt/deckbrowser.py b/aqt/deckbrowser.py index 8447e2a25..95b04bc04 100644 --- a/aqt/deckbrowser.py +++ b/aqt/deckbrowser.py @@ -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