mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 23:42:23 -04:00
Add named constant for preview queue
This commit is contained in:
parent
3a8da4f578
commit
e2a850c2ad
1 changed files with 7 additions and 6 deletions
|
@ -23,6 +23,7 @@ from anki.utils import fmtTimeSpan, ids2str, intTime
|
||||||
CARD_TYPE_RELEARNING = 3
|
CARD_TYPE_RELEARNING = 3
|
||||||
# queue types: 0=new, 1=(re)lrn, 2=rev, 3=day (re)lrn,
|
# queue types: 0=new, 1=(re)lrn, 2=rev, 3=day (re)lrn,
|
||||||
# 4=preview, -1=suspended, -2=sibling buried, -3=manually buried
|
# 4=preview, -1=suspended, -2=sibling buried, -3=manually buried
|
||||||
|
QUEUE_TYPE_PREVIEW = 4
|
||||||
QUEUE_TYPE_SIBLING_BURIED = -2
|
QUEUE_TYPE_SIBLING_BURIED = -2
|
||||||
QUEUE_TYPE_MANUALLY_BURIED = -3
|
QUEUE_TYPE_MANUALLY_BURIED = -3
|
||||||
# revlog types: 0=lrn, 1=rev, 2=relrn, 3=early review
|
# revlog types: 0=lrn, 1=rev, 2=relrn, 3=early review
|
||||||
|
@ -119,7 +120,7 @@ class Scheduler:
|
||||||
|
|
||||||
if ease == 1:
|
if ease == 1:
|
||||||
# repeat after delay
|
# repeat after delay
|
||||||
card.queue = 4
|
card.queue = QUEUE_TYPE_PREVIEW
|
||||||
card.due = intTime() + self._previewDelay(card)
|
card.due = intTime() + self._previewDelay(card)
|
||||||
self.lrnCount += 1
|
self.lrnCount += 1
|
||||||
else:
|
else:
|
||||||
|
@ -158,7 +159,7 @@ order by due"""
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def countIdx(self, card: Card) -> Any:
|
def countIdx(self, card: Card) -> Any:
|
||||||
if card.queue in (3, 4):
|
if card.queue in (3, QUEUE_TYPE_PREVIEW):
|
||||||
return 1
|
return 1
|
||||||
return card.queue
|
return card.queue
|
||||||
|
|
||||||
|
@ -518,8 +519,8 @@ and due <= ?"""
|
||||||
)
|
)
|
||||||
# previews
|
# previews
|
||||||
self.lrnCount += self.col.db.scalar(
|
self.lrnCount += self.col.db.scalar(
|
||||||
"""
|
f"""
|
||||||
select count() from cards where did in %s and queue = 4
|
select count() from cards where did in %s and queue = {QUEUE_TYPE_PREVIEW}
|
||||||
"""
|
"""
|
||||||
% (self._deckLimit())
|
% (self._deckLimit())
|
||||||
)
|
)
|
||||||
|
@ -539,9 +540,9 @@ select count() from cards where did in %s and queue = 4
|
||||||
return True
|
return True
|
||||||
cutoff = intTime() + self.col.conf["collapseTime"]
|
cutoff = intTime() + self.col.conf["collapseTime"]
|
||||||
self._lrnQueue = self.col.db.all(
|
self._lrnQueue = self.col.db.all(
|
||||||
"""
|
f"""
|
||||||
select due, id from cards where
|
select due, id from cards where
|
||||||
did in %s and queue in (1,4) and due < :lim
|
did in %s and queue in (1,{QUEUE_TYPE_PREVIEW}) and due < :lim
|
||||||
limit %d"""
|
limit %d"""
|
||||||
% (self._deckLimit(), self.reportLimit),
|
% (self._deckLimit(), self.reportLimit),
|
||||||
lim=cutoff,
|
lim=cutoff,
|
||||||
|
|
Loading…
Reference in a new issue