if there are no cards to shift, don't try

This commit is contained in:
Damien Elmes 2011-04-21 10:49:25 +09:00
parent 7acdbfa9ae
commit c4c1cdeb6b

View file

@ -809,8 +809,9 @@ where id = :id""", vals)
"select min(due) from cards where due >= ? and type = 0 " "select min(due) from cards where due >= ? and type = 0 "
"and id not in %s" % scids, "and id not in %s" % scids,
start) start)
shiftby = high - low + 1 if low is not None:
self.deck.db.execute(""" shiftby = high - low + 1
self.deck.db.execute("""
update cards set mod=?, due=due+? where id not in %s update cards set mod=?, due=due+? where id not in %s
and due >= ?""" % scids, now, shiftby, low) and due >= ?""" % scids, now, shiftby, low)
# reorder cards # reorder cards