rename _restoreFromFiltered

and use same logic as restoreQueueSnippet
This commit is contained in:
Damien Elmes 2018-02-02 17:18:45 +10:00
parent 3b0c5b2fe9
commit 1dccd7c8d7

View File

@ -105,7 +105,7 @@ class Scheduler:
self.lrnCount += 1 self.lrnCount += 1
else: else:
# restore original card state and remove from filtered deck # restore original card state and remove from filtered deck
self._restoreFromFiltered(card) self._restorePreviewCard(card)
self._removeFromFiltered(card) self._removeFromFiltered(card)
def counts(self, card=None): def counts(self, card=None):
@ -1078,18 +1078,20 @@ where id = ?
card.odue = 0 card.odue = 0
card.odid = 0 card.odid = 0
def _restoreFromFiltered(self, card): def _restorePreviewCard(self, card):
assert card.odid assert card.odid
card.due = card.odue card.due = card.odue
if card.type in (0, 2): # learning and relearning cards may be seconds-based or day-based;
card.queue = card.type # other types map directly to queues
else: if card.type in (1, 3):
if card.odue > 1000000000: if card.odue > 1000000000:
card.queue = 1 card.queue = 1
else: else:
card.queue = 3 card.queue = 3
else:
card.queue = card.type
# Leeches # Leeches
########################################################################## ##########################################################################