mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
fix bug with zero imports, improve speed with zero imports
This commit is contained in:
parent
155de15101
commit
94df742a59
1 changed files with 9 additions and 8 deletions
|
@ -55,14 +55,14 @@ class Importer(object):
|
||||||
self.deck.startProgress(num)
|
self.deck.startProgress(num)
|
||||||
self.deck.updateProgress(_("Importing..."))
|
self.deck.updateProgress(_("Importing..."))
|
||||||
c = self.foreignCards()
|
c = self.foreignCards()
|
||||||
self.importCards(c)
|
if self.importCards(c):
|
||||||
self.deck.updateProgress()
|
|
||||||
self.deck.updateCardTags(self.cardIds)
|
|
||||||
self.deck.updateProgress()
|
|
||||||
self.deck.updatePriorities(self.cardIds)
|
|
||||||
if random:
|
|
||||||
self.deck.updateProgress()
|
self.deck.updateProgress()
|
||||||
self.deck.randomizeNewCards(self.cardIds)
|
self.deck.updateCardTags(self.cardIds)
|
||||||
|
self.deck.updateProgress()
|
||||||
|
self.deck.updatePriorities(self.cardIds)
|
||||||
|
if random:
|
||||||
|
self.deck.updateProgress()
|
||||||
|
self.deck.randomizeNewCards(self.cardIds)
|
||||||
self.deck.finishProgress()
|
self.deck.finishProgress()
|
||||||
if c:
|
if c:
|
||||||
self.deck.setModified()
|
self.deck.setModified()
|
||||||
|
@ -127,12 +127,13 @@ all but one card template."""))
|
||||||
# strip invalid cards
|
# strip invalid cards
|
||||||
cards = self.stripInvalid(cards)
|
cards = self.stripInvalid(cards)
|
||||||
cards = self.stripOrTagDupes(cards)
|
cards = self.stripOrTagDupes(cards)
|
||||||
|
self.cardIds = []
|
||||||
if cards:
|
if cards:
|
||||||
self.addCards(cards)
|
self.addCards(cards)
|
||||||
|
return cards
|
||||||
|
|
||||||
def addCards(self, cards):
|
def addCards(self, cards):
|
||||||
"Add facts in bulk from foreign cards."
|
"Add facts in bulk from foreign cards."
|
||||||
self.cardIds = []
|
|
||||||
# map tags field to attr
|
# map tags field to attr
|
||||||
try:
|
try:
|
||||||
idx = self.mapping.index(0)
|
idx = self.mapping.index(0)
|
||||||
|
|
Loading…
Reference in a new issue