From 1c2b4033485accd9a392b629b88e3370dd427a3a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 19 Apr 2011 06:06:20 +0900 Subject: [PATCH] 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 --- anki/sched.py | 10 ++++++---- tests/test_sched.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/anki/sched.py b/anki/sched.py index 5f0185caf..d838ca1d3 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -262,15 +262,17 @@ queue = 0 %s order by due limit %d""" % (self._groupLimit(), ########################################################################## def _resetLrnCount(self): - self.lrnCount = self.db.scalar( - "select count() from cards where queue = 1 and due < ?", + self.lrnCount = self.db.scalar(""" +select count() from (select id from cards where +queue = 1 %s and due < ? limit %d)""" % ( + self._groupLimit(), self.reportLimit), intTime() + self.deck.qconf['collapseTime']) def _resetLrn(self): self.lrnQueue = self.db.all(""" select due, id from cards where -queue = 1 and due < :lim order by due -limit %d""" % self.reportLimit, lim=self.dayCutoff) +queue = 1 %s and due < :lim order by due +limit %d""" % (self._groupLimit(), self.reportLimit), lim=self.dayCutoff) def _getLrnCard(self, collapse=False): if self.lrnQueue: diff --git a/tests/test_sched.py b/tests/test_sched.py index e6d35c292..e60b44cd5 100644 --- a/tests/test_sched.py +++ b/tests/test_sched.py @@ -543,10 +543,10 @@ def test_counts(): # check limit to one group d.qconf['groups'] = [1] 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 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) def test_counts2():