mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
put cards at end when forgetting; drop support for forgetting leeches
forgetCards() needs to know the highest positioned card, and that requires a full table scan, so it's not appropriate for part of answerCards()
This commit is contained in:
parent
5278b3c2bb
commit
cc0df00fe5
2 changed files with 4 additions and 11 deletions
|
@ -17,7 +17,7 @@ defaultConf = {
|
||||||
'minInt': 1,
|
'minInt': 1,
|
||||||
'relearn': True,
|
'relearn': True,
|
||||||
'leechFails': 16,
|
'leechFails': 16,
|
||||||
# [type, data], where type 0=suspend, 1=tagonly, 2=forget
|
# [type, data], where type 0=suspend, 1=tagonly
|
||||||
'leechAction': [0],
|
'leechAction': [0],
|
||||||
},
|
},
|
||||||
'cram': {
|
'cram': {
|
||||||
|
|
|
@ -552,9 +552,6 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % (
|
||||||
if a == 0:
|
if a == 0:
|
||||||
self.suspendCards([card.id])
|
self.suspendCards([card.id])
|
||||||
card.queue = -1
|
card.queue = -1
|
||||||
elif a == 2:
|
|
||||||
self.forgetCards([card.id])
|
|
||||||
card.due = 1000000
|
|
||||||
# notify UI
|
# notify UI
|
||||||
runHook("leech", card)
|
runHook("leech", card)
|
||||||
|
|
||||||
|
@ -756,12 +753,8 @@ update cards set type=0, queue=0, ivl=0, data=''"""
|
||||||
sids = ids2str(ids)
|
sids = ids2str(ids)
|
||||||
sql += " where id in "+sids
|
sql += " where id in "+sids
|
||||||
self.deck.db.execute(sql)
|
self.deck.db.execute(sql)
|
||||||
if self.deck.randomNew():
|
pmax = self.deck.db.scalar("select max(due) from cards where type=0")
|
||||||
# we need to re-randomize now
|
self.sortCards(ids, start=pmax+1, shuffle=self.deck.randomNew())
|
||||||
self.randomizeNewCards(ids)
|
|
||||||
else:
|
|
||||||
# order by fact id and shift to end of queue, and set mod
|
|
||||||
pass
|
|
||||||
|
|
||||||
def rescheduleCards(self, ids, min, max):
|
def rescheduleCards(self, ids, min, max):
|
||||||
"Reset cards and schedule with new interval in days (min, max)."
|
"Reset cards and schedule with new interval in days (min, max)."
|
||||||
|
@ -787,7 +780,7 @@ queue = 1,
|
||||||
type = 1,
|
type = 1,
|
||||||
where id = :id""", vals)
|
where id = :id""", vals)
|
||||||
|
|
||||||
# Random<->ordered new cards
|
# Repositioning new cards
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def sortCards(self, cids, start=1, step=1, shuffle=False, shift=False):
|
def sortCards(self, cids, start=1, step=1, shuffle=False, shift=False):
|
||||||
|
|
Loading…
Reference in a new issue