From c4c1cdeb6b1d2ebf68da2011105ad7fc6f17a8b8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 21 Apr 2011 10:49:25 +0900 Subject: [PATCH] if there are no cards to shift, don't try --- anki/sched.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/anki/sched.py b/anki/sched.py index 2abd66d48..1a04fa1c6 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -809,8 +809,9 @@ where id = :id""", vals) "select min(due) from cards where due >= ? and type = 0 " "and id not in %s" % scids, start) - shiftby = high - low + 1 - self.deck.db.execute(""" + if low is not None: + shiftby = high - low + 1 + self.deck.db.execute(""" update cards set mod=?, due=due+? where id not in %s and due >= ?""" % scids, now, shiftby, low) # reorder cards