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': {
|
'lapse': {
|
||||||
'delays': [0.5, 3, 10],
|
'delays': [0.5, 3, 10],
|
||||||
'ints': [1, 7, 4],
|
|
||||||
'mult': 0
|
'mult': 0
|
||||||
},
|
},
|
||||||
'suspendLeeches': True,
|
'suspendLeeches': True,
|
||||||
|
|
|
@ -161,10 +161,10 @@ limit %d""" % self.learnLimit, lim=self.dayCutoff)
|
||||||
conf = self.learnConf(card)
|
conf = self.learnConf(card)
|
||||||
leaving = False
|
leaving = False
|
||||||
if ease == 3:
|
if ease == 3:
|
||||||
self.removeLearnCard(card, conf)
|
self.rescheduleAsReview(card, conf, True)
|
||||||
leaving = True
|
leaving = True
|
||||||
elif ease == 2 and card.grade+1 >= len(conf['delays']):
|
elif ease == 2 and card.grade+1 >= len(conf['delays']):
|
||||||
self.graduateLearnCard(card, conf)
|
self.rescheduleAsReview(card, conf, False)
|
||||||
leaving = True
|
leaving = True
|
||||||
else:
|
else:
|
||||||
card.cycles += 1
|
card.cycles += 1
|
||||||
|
@ -189,34 +189,27 @@ limit %d""" % self.learnLimit, lim=self.dayCutoff)
|
||||||
else:
|
else:
|
||||||
return conf['lapse']
|
return conf['lapse']
|
||||||
|
|
||||||
def removeLearnCard(self, card, conf):
|
def rescheduleAsReview(self, card, conf, early):
|
||||||
|
card.queue = 1
|
||||||
|
card.type = 1
|
||||||
if card.type == 1:
|
if card.type == 1:
|
||||||
int_ = None
|
# failed, nothing else to do
|
||||||
elif not card.cycles:
|
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
|
# first time bonus
|
||||||
int_ = conf['ints'][1]
|
int_ = conf['ints'][1]
|
||||||
else:
|
card.interval = int_
|
||||||
# normal remove
|
card.factor = conf['initialFactor']
|
||||||
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
|
|
||||||
|
|
||||||
def logLearn(self, card, ease, conf, leaving):
|
def logLearn(self, card, ease, conf, leaving):
|
||||||
self.deck.db.execute(
|
self.deck.db.execute(
|
||||||
|
|
Loading…
Reference in a new issue