From 9d6b0f35f4b1c57801e2b38b27a154cd9c3b68c6 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 7 Nov 2010 06:48:35 +0900 Subject: [PATCH] ensure cards are scheduled past cutoff, more - because the cutoff adds a few hours past midnight, it's possible for a card that's scheduled for 1.0 days ahead to fall within the current cutoff, so we need to make sure that doesn't happen - set spaceUntil=0 when answering card again - fix randomizeNewCards() query. the whole codebase needs auditing for type references which need updating --- anki/deck.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index 3942c4b0f..7296e36f1 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -763,6 +763,7 @@ where id in """ card.due = self.nextDue(card, ease, oldState) card.isDue = 0 card.lastFactor = card.factor + card.spaceUntil = 0; if lastDelay >= 0: # don't update factor if learning ahead self.updateFactor(card, ease) @@ -780,8 +781,9 @@ where id in """ self.newCount -= 1 # card stats anki.cards.Card.updateStats(card, ease, oldState) - # update type + # update type & ensure past cutoff card.type = self.cardType(card) + card.due = max(card.due, this.dueCutoff+1) # allow custom schedulers to munge the card if self.answerPreSave: self.answerPreSave(card, ease) @@ -985,7 +987,7 @@ where id in %s""" % ids2str(ids), now=time.time(), new=0) def randomizeNewCards(self, cardIds=None): "Randomize 'due' on all new cards." now = time.time() - query = "select distinct factId from cards where type = 2" + query = "select distinct factId from cards where reps = 0" if cardIds: query += " and id in %s" % ids2str(cardIds) fids = self.s.column0(query)