apply selective groups to learning queue too

originally the plan was to get the user to "forget learning cards" or "remove
final drill" when switching between categories, but that's cumbersome and not
intuitive
This commit is contained in:
Damien Elmes 2011-04-19 06:06:20 +09:00
parent 890df46047
commit 1c2b403348
2 changed files with 8 additions and 6 deletions

View file

@ -262,15 +262,17 @@ queue = 0 %s order by due limit %d""" % (self._groupLimit(),
########################################################################## ##########################################################################
def _resetLrnCount(self): def _resetLrnCount(self):
self.lrnCount = self.db.scalar( self.lrnCount = self.db.scalar("""
"select count() from cards where queue = 1 and due < ?", select count() from (select id from cards where
queue = 1 %s and due < ? limit %d)""" % (
self._groupLimit(), self.reportLimit),
intTime() + self.deck.qconf['collapseTime']) intTime() + self.deck.qconf['collapseTime'])
def _resetLrn(self): def _resetLrn(self):
self.lrnQueue = self.db.all(""" self.lrnQueue = self.db.all("""
select due, id from cards where select due, id from cards where
queue = 1 and due < :lim order by due queue = 1 %s and due < :lim order by due
limit %d""" % self.reportLimit, lim=self.dayCutoff) limit %d""" % (self._groupLimit(), self.reportLimit), lim=self.dayCutoff)
def _getLrnCard(self, collapse=False): def _getLrnCard(self, collapse=False):
if self.lrnQueue: if self.lrnQueue:

View file

@ -543,10 +543,10 @@ def test_counts():
# check limit to one group # check limit to one group
d.qconf['groups'] = [1] d.qconf['groups'] = [1]
d.reset() d.reset()
assert d.sched.counts() == (1,2,1) assert d.sched.counts() == (1,1,1)
# 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,1,1)
assert d.sched.allCounts() == (2,2,2) assert d.sched.allCounts() == (2,2,2)
def test_counts2(): def test_counts2():