From d72fb35825a90782ed67911e37736395fb9742e2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 22 May 2013 13:16:12 +0900 Subject: [PATCH] need to order cards after import for sibling spacing (#464) --- anki/importing/noteimp.py | 11 ++++++++++- anki/sched.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/anki/importing/noteimp.py b/anki/importing/noteimp.py index aa3c8ea94..f88406229 100644 --- a/anki/importing/noteimp.py +++ b/anki/importing/noteimp.py @@ -3,6 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import cgi +from anki.consts import NEW_CARDS_RANDOM from anki.lang import _ from anki.utils import fieldChecksum, guid64, timestampID, \ joinFields, intTime, splitFields @@ -173,7 +174,15 @@ class NoteImporter(Importer): "Empty cards found. Please run Tools>Empty Cards.")) # apply scheduling updates self.updateCards() - self.col.sched.maybeRandomizeDeck() + # we randomize or order here, to ensure that siblings + # have the same due# + did = self.col.decks.selected() + conf = self.col.decks.confForDid(did) + # in order due? + if conf['new']['order'] == NEW_CARDS_RANDOM: + self.col.sched.randomizeCards(did) + else: + self.col.sched.orderCards(did) part1 = ngettext("%d note added", "%d notes added", len(new)) % len(new) part2 = ngettext("%d note updated", "%d notes updated", self.updateCount) % self.updateCount self.log.append("%s, %s." % (part1, part2)) diff --git a/anki/sched.py b/anki/sched.py index 0d904e6a8..c06c20a8e 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -1359,4 +1359,4 @@ and due >= ? and queue = 0""" % scids, now, self.col.usn(), shiftby, low) conf = self.col.decks.confForDid(did) # in order due? if conf['new']['order'] == NEW_CARDS_RANDOM: - self.col.sched.randomizeCards(did) + self.randomizeCards(did)