mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
ints makes no sense in the context of failed cards; tweak learn code
This commit is contained in:
parent
8b46cb4daa
commit
9cec4b2059
2 changed files with 20 additions and 28 deletions
|
@ -17,7 +17,6 @@ defaultConf = {
|
|||
},
|
||||
'lapse': {
|
||||
'delays': [0.5, 3, 10],
|
||||
'ints': [1, 7, 4],
|
||||
'mult': 0
|
||||
},
|
||||
'suspendLeeches': True,
|
||||
|
|
|
@ -161,10 +161,10 @@ limit %d""" % self.learnLimit, lim=self.dayCutoff)
|
|||
conf = self.learnConf(card)
|
||||
leaving = False
|
||||
if ease == 3:
|
||||
self.removeLearnCard(card, conf)
|
||||
self.rescheduleAsReview(card, conf, True)
|
||||
leaving = True
|
||||
elif ease == 2 and card.grade+1 >= len(conf['delays']):
|
||||
self.graduateLearnCard(card, conf)
|
||||
self.rescheduleAsReview(card, conf, False)
|
||||
leaving = True
|
||||
else:
|
||||
card.cycles += 1
|
||||
|
@ -189,34 +189,27 @@ limit %d""" % self.learnLimit, lim=self.dayCutoff)
|
|||
else:
|
||||
return conf['lapse']
|
||||
|
||||
def removeLearnCard(self, card, conf):
|
||||
def rescheduleAsReview(self, card, conf, early):
|
||||
card.queue = 1
|
||||
card.type = 1
|
||||
if card.type == 1:
|
||||
int_ = None
|
||||
elif not card.cycles:
|
||||
# failed, nothing else to do
|
||||
pass
|
||||
else:
|
||||
self.rescheduleNew(card, conf, early)
|
||||
|
||||
def rescheduleNew(self, card, conf, early):
|
||||
if not early:
|
||||
# graduate
|
||||
int_ = conf['ints'][0]
|
||||
elif card.cycles:
|
||||
# remove
|
||||
int_ = conf['ints'][2]
|
||||
else:
|
||||
# first time bonus
|
||||
int_ = conf['ints'][1]
|
||||
else:
|
||||
# normal remove
|
||||
int_ = conf['ints'][2]
|
||||
self.rescheduleAsReview(card, conf, int_)
|
||||
|
||||
def graduateLearnCard(self, card, conf):
|
||||
if card.type == 1:
|
||||
int_ = None
|
||||
else:
|
||||
int_ = conf['ints'][0]
|
||||
self.rescheduleAsReview(card, conf, int_)
|
||||
|
||||
def rescheduleAsReview(self, card, conf, int_):
|
||||
card.queue = 1
|
||||
if int_:
|
||||
# new card
|
||||
card.type = 1
|
||||
card.interval = int_
|
||||
card.factor = conf['initialFactor']
|
||||
else:
|
||||
# failed card
|
||||
pass
|
||||
card.interval = int_
|
||||
card.factor = conf['initialFactor']
|
||||
|
||||
def logLearn(self, card, ease, conf, leaving):
|
||||
self.deck.db.execute(
|
||||
|
|
Loading…
Reference in a new issue