mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
parent
8516ed8655
commit
6204a86879
2 changed files with 9 additions and 55 deletions
|
@ -859,47 +859,3 @@ update cards set queue={QUEUE_TYPE_SIBLING_BURIED},mod=?,usn=? where id in """
|
|||
intTime(),
|
||||
self.col.usn(),
|
||||
)
|
||||
|
||||
# Sibling spacing
|
||||
##########################################################################
|
||||
|
||||
def _burySiblings(self, card: Card) -> None:
|
||||
toBury = []
|
||||
nconf = self._newConf(card)
|
||||
buryNew = nconf.get("bury", True)
|
||||
rconf = self._revConf(card)
|
||||
buryRev = rconf.get("bury", True)
|
||||
# loop through and remove from queues
|
||||
for cid, queue in self.col.db.execute(
|
||||
f"""
|
||||
select id, queue from cards where nid=? and id!=?
|
||||
and (queue={QUEUE_TYPE_NEW} or (queue={QUEUE_TYPE_REV} and due<=?))""",
|
||||
card.nid,
|
||||
card.id,
|
||||
self.today,
|
||||
):
|
||||
if queue == QUEUE_TYPE_REV:
|
||||
if buryRev:
|
||||
toBury.append(cid)
|
||||
# if bury disabled, we still discard to give same-day spacing
|
||||
try:
|
||||
self._revQueue.remove(cid)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
# if bury disabled, we still discard to give same-day spacing
|
||||
if buryNew:
|
||||
toBury.append(cid)
|
||||
try:
|
||||
self._newQueue.remove(cid)
|
||||
except ValueError:
|
||||
pass
|
||||
# then bury
|
||||
if toBury:
|
||||
self.col.db.execute(
|
||||
f"update cards set queue={QUEUE_TYPE_SIBLING_BURIED},mod=?,usn=? where id in "
|
||||
+ ids2str(toBury),
|
||||
intTime(),
|
||||
self.col.usn(),
|
||||
)
|
||||
self.col.log(toBury)
|
||||
|
|
|
@ -1523,7 +1523,7 @@ update cards set queue=?,mod=?,usn=? where id in """
|
|||
##########################################################################
|
||||
|
||||
def _burySiblings(self, card: Card) -> None:
|
||||
toBury = []
|
||||
toBury: List[int] = []
|
||||
nconf = self._newConf(card)
|
||||
buryNew = nconf.get("bury", True)
|
||||
rconf = self._revConf(card)
|
||||
|
@ -1538,21 +1538,19 @@ and (queue={QUEUE_TYPE_NEW} or (queue={QUEUE_TYPE_REV} and due<=?))""",
|
|||
self.today,
|
||||
):
|
||||
if queue == QUEUE_TYPE_REV:
|
||||
queue_obj = self._revQueue
|
||||
if buryRev:
|
||||
toBury.append(cid)
|
||||
# if bury disabled, we still discard to give same-day spacing
|
||||
try:
|
||||
self._revQueue.remove(cid)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
# if bury disabled, we still discard to give same-day spacing
|
||||
queue_obj = self._newQueue
|
||||
if buryNew:
|
||||
toBury.append(cid)
|
||||
try:
|
||||
self._newQueue.remove(cid)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# even if burying disabled, we still discard to give same-day spacing
|
||||
try:
|
||||
queue_obj.remove(cid)
|
||||
except ValueError:
|
||||
pass
|
||||
# then bury
|
||||
if toBury:
|
||||
self.buryCards(toBury, manual=False)
|
||||
|
|
Loading…
Reference in a new issue