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():