mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
make sure the failed card count reflects the cutoff
This commit is contained in:
parent
8b747c3aac
commit
e8d6714130
3 changed files with 25 additions and 3 deletions
|
@ -34,8 +34,6 @@ class CramScheduler(Scheduler):
|
||||||
if card.queue == 2:
|
if card.queue == 2:
|
||||||
card.queue = 1
|
card.queue = 1
|
||||||
card.edue = card.due
|
card.edue = card.due
|
||||||
if ease < 3:
|
|
||||||
self.lrnCount += 1
|
|
||||||
if card.queue == 1:
|
if card.queue == 1:
|
||||||
self._answerLrnCard(card, ease)
|
self._answerLrnCard(card, ease)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -43,7 +43,6 @@ class Scheduler(object):
|
||||||
if card.queue == 0:
|
if card.queue == 0:
|
||||||
# put it in the learn queue
|
# put it in the learn queue
|
||||||
card.queue = 1
|
card.queue = 1
|
||||||
self.lrnCount += 1
|
|
||||||
if card.queue == 1:
|
if card.queue == 1:
|
||||||
self._answerLrnCard(card, ease)
|
self._answerLrnCard(card, ease)
|
||||||
elif card.queue == 2:
|
elif card.queue == 2:
|
||||||
|
@ -309,6 +308,9 @@ limit %d""" % self.reportLimit, lim=self.dayCutoff)
|
||||||
delay *= random.uniform(1, 1.25)
|
delay *= random.uniform(1, 1.25)
|
||||||
card.due = time.time() + delay
|
card.due = time.time() + delay
|
||||||
heappush(self.lrnQueue, (card.due, card.id))
|
heappush(self.lrnQueue, (card.due, card.id))
|
||||||
|
# if it's due within the cutoff, increment count
|
||||||
|
if delay <= self.deck.qconf['collapseTime']:
|
||||||
|
self.lrnCount += 1
|
||||||
self._logLrn(card, ease, conf, leaving, type)
|
self._logLrn(card, ease, conf, leaving, type)
|
||||||
|
|
||||||
def _delayForGrade(self, conf, grade):
|
def _delayForGrade(self, conf, grade):
|
||||||
|
|
|
@ -549,6 +549,28 @@ def test_counts():
|
||||||
assert d.sched.selCounts() == (1,2,1)
|
assert d.sched.selCounts() == (1,2,1)
|
||||||
assert d.sched.allCounts() == (2,2,2)
|
assert d.sched.allCounts() == (2,2,2)
|
||||||
|
|
||||||
|
def test_counts2():
|
||||||
|
d = getEmptyDeck()
|
||||||
|
f = d.newFact()
|
||||||
|
f['Front'] = u"one"; f['Back'] = u"two"
|
||||||
|
d.addFact(f)
|
||||||
|
d.reset()
|
||||||
|
assert d.sched.counts() == (1, 0, 0)
|
||||||
|
c = d.sched.getCard()
|
||||||
|
# counter's been decremented but idx indicates 1
|
||||||
|
assert d.sched.counts() == (0, 0, 0)
|
||||||
|
assert d.sched.countIdx(c) == 0
|
||||||
|
# answer to move to learn queue
|
||||||
|
d.sched.answerCard(c, 1)
|
||||||
|
assert d.sched.counts() == (0, 1, 0)
|
||||||
|
# fetching again will decrement the count
|
||||||
|
c = d.sched.getCard()
|
||||||
|
assert d.sched.counts() == (0, 0, 0)
|
||||||
|
assert d.sched.countIdx(c) == 1
|
||||||
|
# answering should add it back again
|
||||||
|
d.sched.answerCard(c, 1)
|
||||||
|
assert d.sched.counts() == (0, 1, 0)
|
||||||
|
|
||||||
def test_timing():
|
def test_timing():
|
||||||
d = getEmptyDeck()
|
d = getEmptyDeck()
|
||||||
# add a few review cards, due today
|
# add a few review cards, due today
|
||||||
|
|
Loading…
Reference in a new issue