mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
better learn-ahead handling
This commit is contained in:
parent
fe17d6c53e
commit
8bd84d4dfe
1 changed files with 9 additions and 5 deletions
14
anki/deck.py
14
anki/deck.py
|
@ -318,6 +318,7 @@ where factId in (select factId from %s limit 60))""" % (new, new))
|
||||||
undoName = _("Answer Card")
|
undoName = _("Answer Card")
|
||||||
self.setUndoStart(undoName)
|
self.setUndoStart(undoName)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
# old state
|
||||||
oldState = self.cardState(card)
|
oldState = self.cardState(card)
|
||||||
lastDelaySecs = time.time() - card.combinedDue
|
lastDelaySecs = time.time() - card.combinedDue
|
||||||
lastDelay = lastDelaySecs / 86400.0
|
lastDelay = lastDelaySecs / 86400.0
|
||||||
|
@ -332,7 +333,9 @@ where factId in (select factId from %s limit 60))""" % (new, new))
|
||||||
card.due = self.nextDue(card, ease, oldState)
|
card.due = self.nextDue(card, ease, oldState)
|
||||||
card.isDue = 0
|
card.isDue = 0
|
||||||
card.lastFactor = card.factor
|
card.lastFactor = card.factor
|
||||||
self.updateFactor(card, ease)
|
if lastDelay >= 0:
|
||||||
|
# don't update factor if learning ahead
|
||||||
|
self.updateFactor(card, ease)
|
||||||
# spacing
|
# spacing
|
||||||
(minSpacing, spaceFactor) = self.s.first("""
|
(minSpacing, spaceFactor) = self.s.first("""
|
||||||
select models.initialSpacing, models.spacing from
|
select models.initialSpacing, models.spacing from
|
||||||
|
@ -384,7 +387,7 @@ where id != :id and factId = :factId""",
|
||||||
entry.writeSQL(self.s)
|
entry.writeSQL(self.s)
|
||||||
self.modified = now
|
self.modified = now
|
||||||
self.setUndoEnd(undoName)
|
self.setUndoEnd(undoName)
|
||||||
# decrease card boost
|
# decrease new card boost
|
||||||
if self.extraNewCards:
|
if self.extraNewCards:
|
||||||
self.extraNewCards -= 1
|
self.extraNewCards -= 1
|
||||||
|
|
||||||
|
@ -399,11 +402,12 @@ where id != :id and factId = :factId""",
|
||||||
def _nextInterval(self, card, delay, ease):
|
def _nextInterval(self, card, delay, ease):
|
||||||
interval = card.interval
|
interval = card.interval
|
||||||
factor = card.factor
|
factor = card.factor
|
||||||
if delay < 0:
|
# if shown early and not failed
|
||||||
interval = card.lastInterval + ((interval - abs(delay)) / 2.0)
|
if delay < 0 and card.successive:
|
||||||
delay = 0
|
interval = max(card.lastInterval, card.interval + delay)
|
||||||
if interval < self.midIntervalMin:
|
if interval < self.midIntervalMin:
|
||||||
interval = 0
|
interval = 0
|
||||||
|
delay = 0
|
||||||
# if interval is less than mid interval, use presets
|
# if interval is less than mid interval, use presets
|
||||||
if ease == 1:
|
if ease == 1:
|
||||||
interval *= self.delay2
|
interval *= self.delay2
|
||||||
|
|
Loading…
Reference in a new issue