make sure card count is properly updated in importing

This commit is contained in:
Damien Elmes 2009-07-04 15:40:36 +09:00
parent 932440165a
commit 0d0b9fc81e

View file

@ -172,9 +172,11 @@ where factId in (%s)""" % ",".join([str(s) for s in factIds]))
# and cards # and cards
self.deck.updateProgress() self.deck.updateProgress()
now = time.time() now = time.time()
active = 0
for cm in self.model.cardModels: for cm in self.model.cardModels:
self._now = now self._now = now
if cm.active: if cm.active:
active += 1
data = [self.addMeta({ data = [self.addMeta({
'id': genID(), 'id': genID(),
'factId': factIds[m], 'factId': factIds[m],
@ -187,7 +189,7 @@ where factId in (%s)""" % ",".join([str(s) for s in factIds]))
data) data)
self.deck.updateProgress() self.deck.updateProgress()
self.deck.updateCardsFromFactIds(factIds) self.deck.updateCardsFromFactIds(factIds)
self.deck.cardCount += len(cards) self.deck.cardCount += len(cards) * active
self.total = len(factIds) self.total = len(factIds)
def addMeta(self, data, card): def addMeta(self, data, card):