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.db = deck.db
|
||||||
self.queueLimit = 200
|
self.queueLimit = 200
|
||||||
self.reportLimit = 1000
|
self.reportLimit = 1000
|
||||||
self.useGroups = True
|
|
||||||
self._updateCutoff()
|
self._updateCutoff()
|
||||||
|
|
||||||
def getCard(self):
|
def getCard(self):
|
||||||
|
@ -95,14 +94,16 @@ order by due""" % self._groupLimit(),
|
||||||
|
|
||||||
def selCounts(self):
|
def selCounts(self):
|
||||||
"Return counts for selected groups, without building queue."
|
"Return counts for selected groups, without building queue."
|
||||||
self.useGroups = True
|
|
||||||
self._resetCounts()
|
self._resetCounts()
|
||||||
return self.counts()
|
return self.counts()
|
||||||
|
|
||||||
def allCounts(self):
|
def allCounts(self):
|
||||||
"Return counts for all groups, without building queue."
|
"Return counts for all groups, without building queue."
|
||||||
self.useGroups = False
|
conf = self.deck.qconf['groups']
|
||||||
|
if conf:
|
||||||
|
self.deck.qconf['groups'] = []
|
||||||
self._resetCounts()
|
self._resetCounts()
|
||||||
|
self.deck.qconf['groups'] = conf
|
||||||
return self.counts()
|
return self.counts()
|
||||||
|
|
||||||
def _resetCounts(self):
|
def _resetCounts(self):
|
||||||
|
@ -552,8 +553,6 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % (
|
||||||
return self.confCache[id]
|
return self.confCache[id]
|
||||||
|
|
||||||
def _groupLimit(self):
|
def _groupLimit(self):
|
||||||
if not self.useGroups:
|
|
||||||
return ""
|
|
||||||
l = self.deck.qconf['groups']
|
l = self.deck.qconf['groups']
|
||||||
if not l:
|
if not l:
|
||||||
# everything
|
# everything
|
||||||
|
|
|
@ -541,10 +541,6 @@ def test_counts():
|
||||||
d.qconf['groups'] = [1]
|
d.qconf['groups'] = [1]
|
||||||
d.reset()
|
d.reset()
|
||||||
assert d.sched.counts() == (1,2,1)
|
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
|
# we don't need to build the queue to get the counts
|
||||||
assert d.sched.allCounts() == (2,2,2)
|
assert d.sched.allCounts() == (2,2,2)
|
||||||
assert d.sched.selCounts() == (1,2,1)
|
assert d.sched.selCounts() == (1,2,1)
|
||||||
|
|
Loading…
Reference in a new issue