From 09f51e27f0b70f3ffa98b832ab5f590be2ea0186 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 5 Feb 2010 12:59:54 +0900 Subject: [PATCH] return newly created card ids when generating cards --- anki/deck.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/anki/deck.py b/anki/deck.py index af958155a..406a14d2a 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -1107,6 +1107,7 @@ and due < :now""" % self.forceIndex("ix_cards_priorityDue"), now=time.time()) def addCards(self, fact, cardModelIds): "Caller must flush first, flushMod after, rebuild priorities." + ids = [] for cardModel in self.availableCardModels(fact, False): if cardModel.id not in cardModelIds: continue @@ -1120,7 +1121,9 @@ where factId = :fid and cardModelId = :cmid""", self.updatePriority(card) self.cardCount += 1 self.newCount += 1 + ids.append(card.id) self.setModified() + return ids def factIsInvalid(self, fact): "True if existing fact is invalid. Returns the error."