From 29cb76de8ffd25211b930b10aae12f54ca16183c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 12 Apr 2012 17:30:14 +0900 Subject: [PATCH] add check for broken review due #s --- anki/collection.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/anki/collection.py b/anki/collection.py index 1237daa53..eb6bfd36c 100644 --- a/anki/collection.py +++ b/anki/collection.py @@ -577,6 +577,14 @@ select id from notes where id not in (select distinct nid from cards)""") # new card position self.conf['nextPos'] = self.db.scalar( "select max(due)+1 from cards where type = 0") or 0 + # reviews should have a reasonable due # + ids = self.db.list( + "select id from cards where queue = 2 and due > 10000") + if ids: + problems.append("Reviews had incorrect due date.") + self.db.execute( + "update cards set due = 0, mod = ?, usn = ? where id in %s" + % ids2str(ids), intTime(), self.usn()) # and finally, optimize self.optimize() newSize = os.stat(self.path)[stat.ST_SIZE]