mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
when rescheduling ensure ivl >= 1; remove dead code
This commit is contained in:
parent
88c4f010d3
commit
2fa767c503
1 changed files with 3 additions and 6 deletions
|
@ -753,17 +753,14 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % (
|
|||
pmax = self.deck.db.scalar("select max(due) from cards where type=0")
|
||||
self.sortCards(ids, start=pmax+1, shuffle=self.deck.randomNew())
|
||||
|
||||
def reschedCards(self, ids, min, max):
|
||||
def reschedCards(self, ids, imin, imax):
|
||||
"Put cards in review queue with a new interval in days (min, max)."
|
||||
self.deck.db.execute(
|
||||
"update cards set type=2, queue=2 where id in "+ids2str(ids))
|
||||
|
||||
d = []
|
||||
t = self.today
|
||||
mod = intTime()
|
||||
for id in ids:
|
||||
r = random.randint(min, max)
|
||||
d.append(dict(id=id, due=r+t, ivl=r, mod=mod))
|
||||
r = random.randint(imin, imax)
|
||||
d.append(dict(id=id, due=r+t, ivl=max(1, r), mod=mod))
|
||||
self.deck.db.executemany(
|
||||
"update cards set type=2,queue=2,ivl=:ivl,due=:due where id=:id",
|
||||
d)
|
||||
|
|
Loading…
Reference in a new issue