need to order cards after import for sibling spacing (#464)

This commit is contained in:
Damien Elmes 2013-05-22 13:16:12 +09:00
parent 41d7f716bb
commit d72fb35825
2 changed files with 11 additions and 2 deletions

View File

@ -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))

View File

@ -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)