fix bug with zero imports, improve speed with zero imports

This commit is contained in:
Damien Elmes 2009-04-23 02:00:52 +09:00
parent 155de15101
commit 94df742a59

View file

@ -55,7 +55,7 @@ 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.updateProgress()
self.deck.updateCardTags(self.cardIds) self.deck.updateCardTags(self.cardIds)
self.deck.updateProgress() self.deck.updateProgress()
@ -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)