mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
support new cards first
This commit is contained in:
parent
e9d2e6595e
commit
943e006322
1 changed files with 12 additions and 6 deletions
10
anki/deck.py
10
anki/deck.py
|
|
@ -34,8 +34,9 @@ PRIORITY_NORM = 2
|
||||||
PRIORITY_LOW = 1
|
PRIORITY_LOW = 1
|
||||||
PRIORITY_NONE = 0
|
PRIORITY_NONE = 0
|
||||||
MATURE_THRESHOLD = 21
|
MATURE_THRESHOLD = 21
|
||||||
NEW_CARDS_LAST = 1
|
|
||||||
NEW_CARDS_DISTRIBUTE = 0
|
NEW_CARDS_DISTRIBUTE = 0
|
||||||
|
NEW_CARDS_LAST = 1
|
||||||
|
NEW_CARDS_FIRST = 2
|
||||||
REV_CARDS_OLD_FIRST = 0
|
REV_CARDS_OLD_FIRST = 0
|
||||||
REV_CARDS_NEW_FIRST = 1
|
REV_CARDS_NEW_FIRST = 1
|
||||||
REV_CARDS_DUE_FIRST = 2
|
REV_CARDS_DUE_FIRST = 2
|
||||||
|
|
@ -139,7 +140,6 @@ class Deck(object):
|
||||||
return self.s.scalar(
|
return self.s.scalar(
|
||||||
"select id from failedCards limit 1")
|
"select id from failedCards limit 1")
|
||||||
# distribute new cards?
|
# distribute new cards?
|
||||||
if self.newCardSpacing == NEW_CARDS_DISTRIBUTE:
|
|
||||||
if self._timeForNewCard():
|
if self._timeForNewCard():
|
||||||
id = self._maybeGetNewCard()
|
id = self._maybeGetNewCard()
|
||||||
if id:
|
if id:
|
||||||
|
|
@ -162,11 +162,15 @@ class Deck(object):
|
||||||
|
|
||||||
def _timeForNewCard(self):
|
def _timeForNewCard(self):
|
||||||
"True if it's time to display a new card when distributing."
|
"True if it's time to display a new card when distributing."
|
||||||
|
if self.newCardSpacing == NEW_CARDS_LAST:
|
||||||
|
return False
|
||||||
# force old if there are very high priority cards
|
# force old if there are very high priority cards
|
||||||
if self.s.scalar(
|
if self.s.scalar(
|
||||||
"select 1 from cards where type = 1 and isDue = 1 "
|
"select 1 from cards where type = 1 and isDue = 1 "
|
||||||
"and priority = 4 limit 1"):
|
"and priority = 4 limit 1"):
|
||||||
return False
|
return False
|
||||||
|
if self.newCardSpacing == NEW_CARDS_FIRST:
|
||||||
|
return True
|
||||||
if self.newCardModulus:
|
if self.newCardModulus:
|
||||||
return self._dailyStats.reps % self.newCardModulus == 0
|
return self._dailyStats.reps % self.newCardModulus == 0
|
||||||
else:
|
else:
|
||||||
|
|
@ -215,6 +219,8 @@ class Deck(object):
|
||||||
|
|
||||||
# Getting cards in bulk
|
# Getting cards in bulk
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
# this is used for the website and ankimini
|
||||||
|
# done in rows for efficiency
|
||||||
|
|
||||||
def getCards(self, extraMunge=None):
|
def getCards(self, extraMunge=None):
|
||||||
"Get a number of cards and related data for client display."
|
"Get a number of cards and related data for client display."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue