NF: CardType type

This commit is contained in:
Arthur Milchior 2021-03-23 13:15:16 +01:00 committed by Damien Elmes
parent 365de5f232
commit be630adab9
4 changed files with 9 additions and 7 deletions

View file

@ -40,6 +40,7 @@ class Card:
did: anki.decks.DeckID
odid: anki.decks.DeckID
queue: CardQueue
type: CardType
def __init__(
self, col: anki.collection.Collection, id: Optional[CardID] = None
@ -69,7 +70,7 @@ class Card:
self.ord = c.template_idx
self.mod = c.mtime_secs
self.usn = c.usn
self.type = c.ctype
self.type = CardType(c.ctype)
self.queue = CardQueue(c.queue)
self.due = c.due
self.ivl = c.interval

View file

@ -29,10 +29,11 @@ QUEUE_TYPE_DAY_LEARN_RELEARN = CardQueue(3)
QUEUE_TYPE_PREVIEW = CardQueue(4)
# Card types
CARD_TYPE_NEW = 0
CARD_TYPE_LRN = 1
CARD_TYPE_REV = 2
CARD_TYPE_RELEARNING = 3
CardType = NewType("CardType", int)
CARD_TYPE_NEW = CardType(0)
CARD_TYPE_LRN = CardType(1)
CARD_TYPE_REV = CardType(2)
CARD_TYPE_RELEARNING = CardType(3)
# removal types
REM_CARD = 0

View file

@ -37,7 +37,6 @@ default_deck_id = DeckID(1)
default_deck_conf_id = DeckConfID(1)
class DecksDictProxy:
def __init__(self, col: anki.collection.Collection):
self._col = col.weakref()

View file

@ -722,7 +722,8 @@ limit ?"""
card.ivl = self._graduatingIvl(card, conf, early)
card.due = self.today + card.ivl
card.factor = conf["initialFactor"]
card.type = card.queue = QUEUE_TYPE_REV
card.type = CARD_TYPE_REV
card.queue = QUEUE_TYPE_REV
def _logLrn(
self,