From cc0df00fe5d228db9f5894da63562e7a954f5b4e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 21 Apr 2011 11:32:36 +0900 Subject: [PATCH] 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() --- anki/groups.py | 2 +- anki/sched.py | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/anki/groups.py b/anki/groups.py index 22798f6f5..bac8aab46 100644 --- a/anki/groups.py +++ b/anki/groups.py @@ -17,7 +17,7 @@ defaultConf = { 'minInt': 1, 'relearn': True, 'leechFails': 16, - # [type, data], where type 0=suspend, 1=tagonly, 2=forget + # [type, data], where type 0=suspend, 1=tagonly 'leechAction': [0], }, 'cram': { diff --git a/anki/sched.py b/anki/sched.py index 1a04fa1c6..0244fcea6 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -552,9 +552,6 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % ( if a == 0: self.suspendCards([card.id]) card.queue = -1 - elif a == 2: - self.forgetCards([card.id]) - card.due = 1000000 # notify UI runHook("leech", card) @@ -756,12 +753,8 @@ update cards set type=0, queue=0, ivl=0, data=''""" sids = ids2str(ids) sql += " where id in "+sids self.deck.db.execute(sql) - if self.deck.randomNew(): - # we need to re-randomize now - self.randomizeNewCards(ids) - else: - # order by fact id and shift to end of queue, and set mod - pass + pmax = self.deck.db.scalar("select max(due) from cards where type=0") + self.sortCards(ids, start=pmax+1, shuffle=self.deck.randomNew()) def rescheduleCards(self, ids, min, max): "Reset cards and schedule with new interval in days (min, max)." @@ -787,7 +780,7 @@ queue = 1, type = 1, where id = :id""", vals) - # Random<->ordered new cards + # Repositioning new cards ########################################################################## def sortCards(self, cids, start=1, step=1, shuffle=False, shift=False):