From 99ba3f09c8ce4477405d88a2c78bc7d31da2a0bf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 12 Sep 2010 12:21:39 +0900 Subject: [PATCH] catch missing facts at end of sync --- anki/sync.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/anki/sync.py b/anki/sync.py index 8abe25914..4bc60e768 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -206,6 +206,12 @@ class SyncTools(object): self.rebuildPriorities(cardIds) # rebuild due counts self.deck.rebuildCounts(full=False) + assert self.missingFacts() == 0 + + def missingFacts(self): + return self.deck.s.scalar( + "select count() from cards where factId "+ + "not in (select id from facts)"); def rebuildPriorities(self, cardIds, suspend=[]): self.deck.updateAllPriorities(partial=True, dirty=False)