don't need relearn flag, can infer from empty delays list

This commit is contained in:
Damien Elmes 2011-12-09 08:36:00 +09:00
parent 451962d4a8
commit 20ffbd57a7
3 changed files with 4 additions and 5 deletions

View file

@ -32,7 +32,6 @@ defaultConf = {
'delays': [1, 10],
'mult': 0,
'minInt': 1,
'relearn': True,
'leechFails': 8,
# type 0=suspend, 1=tagonly
'leechAction': 0,

View file

@ -557,14 +557,14 @@ did = ? and queue = 2 and due <= ? %s limit ?""" % order,
card.factor = max(1300, card.factor-200)
card.due = self.today + card.ivl
# put back in the learn queue?
if conf['relearn']:
if conf['delays']:
card.edue = card.due
card.due = int(self._delayForGrade(conf, 0) + time.time())
card.left = len(conf['delays'])
card.queue = 1
self.lrnCount += card.left
# leech?
if not self._checkLeech(card, conf) and conf['relearn']:
if not self._checkLeech(card, conf) and conf['delays']:
heappush(self._lrnQueue, (card.due, card.id))
def _nextLapseIvl(self, card, conf):
@ -763,7 +763,7 @@ your short-term review workload will become."""))
elif ease == 1:
# lapsed
conf = self._cardConf(card)['lapse']
if conf['relearn']:
if conf['delays']:
return conf['delays'][0]*60
return self._nextLapseIvl(card, conf)*86400
else:

View file

@ -349,7 +349,7 @@ def test_nextIvl():
# failing it should put it at 60s
assert ni(c, 1) == 60
# or 1 day if relearn is false
d.sched._cardConf(c)['lapse']['relearn']=False
d.sched._cardConf(c)['lapse']['delays']=[]
assert ni(c, 1) == 1*86400
# (* 100 1.2 86400)10368000.0
assert ni(c, 2) == 10368000