mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
ditch useGroups
This commit is contained in:
parent
f75e2af195
commit
77ee8f1385
2 changed files with 5 additions and 10 deletions
|
@ -19,7 +19,6 @@ class Scheduler(object):
|
|||
self.db = deck.db
|
||||
self.queueLimit = 200
|
||||
self.reportLimit = 1000
|
||||
self.useGroups = True
|
||||
self._updateCutoff()
|
||||
|
||||
def getCard(self):
|
||||
|
@ -95,14 +94,16 @@ order by due""" % self._groupLimit(),
|
|||
|
||||
def selCounts(self):
|
||||
"Return counts for selected groups, without building queue."
|
||||
self.useGroups = True
|
||||
self._resetCounts()
|
||||
return self.counts()
|
||||
|
||||
def allCounts(self):
|
||||
"Return counts for all groups, without building queue."
|
||||
self.useGroups = False
|
||||
self._resetCounts()
|
||||
conf = self.deck.qconf['groups']
|
||||
if conf:
|
||||
self.deck.qconf['groups'] = []
|
||||
self._resetCounts()
|
||||
self.deck.qconf['groups'] = conf
|
||||
return self.counts()
|
||||
|
||||
def _resetCounts(self):
|
||||
|
@ -552,8 +553,6 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % (
|
|||
return self.confCache[id]
|
||||
|
||||
def _groupLimit(self):
|
||||
if not self.useGroups:
|
||||
return ""
|
||||
l = self.deck.qconf['groups']
|
||||
if not l:
|
||||
# everything
|
||||
|
|
|
@ -541,10 +541,6 @@ def test_counts():
|
|||
d.qconf['groups'] = [1]
|
||||
d.reset()
|
||||
assert d.sched.counts() == (1,2,1)
|
||||
# we can disable the groups without forgetting them
|
||||
d.sched.useGroups = False
|
||||
d.reset()
|
||||
assert d.sched.counts() == (2,2,2)
|
||||
# we don't need to build the queue to get the counts
|
||||
assert d.sched.allCounts() == (2,2,2)
|
||||
assert d.sched.selCounts() == (1,2,1)
|
||||
|
|
Loading…
Reference in a new issue