mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
fix reps updating in v2, but do it in answerCard instead of getCard
This commit is contained in:
parent
9c0656329b
commit
4387e3ed86
4 changed files with 11 additions and 5 deletions
|
@ -702,13 +702,19 @@ table.review-log {{ {revlog_style} }}
|
|||
|
||||
# Timeboxing
|
||||
##########################################################################
|
||||
# fixme: there doesn't seem to be a good reason why this code is in main.py
|
||||
# instead of covered in reviewer, and the reps tracking is covered by both
|
||||
# the scheduler and reviewer.py. in the future, we should probably move
|
||||
# reps tracking to reviewer.py, and remove the startTimebox() calls from
|
||||
# other locations like overview.py. We just need to make sure not to reset
|
||||
# the count on things like edits, which we probably could do by checking
|
||||
# the previous state in moveToState.
|
||||
|
||||
def startTimebox(self) -> None:
|
||||
self._startTime = time.time()
|
||||
self._startReps = self.sched.reps
|
||||
|
||||
# FIXME: Use Literal[False] when on Python 3.8
|
||||
def timeboxReached(self) -> Union[bool, Tuple[Any, int]]:
|
||||
def timeboxReached(self) -> Union[Literal[False], Tuple[Any, int]]:
|
||||
"Return (elapsedTime, reps) if timebox reached, or False."
|
||||
if not self.conf["timeLim"]:
|
||||
# timeboxing disabled
|
||||
|
|
|
@ -49,6 +49,7 @@ class Scheduler(V2):
|
|||
if self._burySiblingsOnAnswer:
|
||||
self._burySiblings(card)
|
||||
card.reps += 1
|
||||
self.reps += 1
|
||||
# former is for logging new cards, latter also covers filt. decks
|
||||
card.wasNew = card.type == CARD_TYPE_NEW # type: ignore
|
||||
wasNewQ = card.queue == QUEUE_TYPE_NEW
|
||||
|
|
|
@ -28,7 +28,6 @@ UnburyCurrentDeck = _pb.UnburyCardsInCurrentDeckIn
|
|||
BuryOrSuspend = _pb.BuryOrSuspendCardsIn
|
||||
|
||||
# fixme: reviewer.cardQueue/editCurrent/undo handling/retaining current card
|
||||
# fixme: .reps
|
||||
|
||||
|
||||
class Scheduler:
|
||||
|
@ -36,8 +35,7 @@ class Scheduler:
|
|||
|
||||
def __init__(self, col: anki.collection.Collection) -> None:
|
||||
self.col = col.weakref()
|
||||
# fixme: only used by the timeboxing code, and was double-incremented
|
||||
# for ages - just move to gui?
|
||||
# don't rely on this, it will likely be removed out in the future
|
||||
self.reps = 0
|
||||
|
||||
# Timing
|
||||
|
|
|
@ -489,6 +489,7 @@ limit ?"""
|
|||
self._answerCardPreview(card, ease)
|
||||
return
|
||||
|
||||
self.reps += 1
|
||||
card.reps += 1
|
||||
|
||||
new_delta = 0
|
||||
|
|
Loading…
Reference in a new issue