mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05: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")
|
pmax = self.deck.db.scalar("select max(due) from cards where type=0")
|
||||||
self.sortCards(ids, start=pmax+1, shuffle=self.deck.randomNew())
|
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)."
|
"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 = []
|
d = []
|
||||||
t = self.today
|
t = self.today
|
||||||
mod = intTime()
|
mod = intTime()
|
||||||
for id in ids:
|
for id in ids:
|
||||||
r = random.randint(min, max)
|
r = random.randint(imin, imax)
|
||||||
d.append(dict(id=id, due=r+t, ivl=r, mod=mod))
|
d.append(dict(id=id, due=r+t, ivl=max(1, r), mod=mod))
|
||||||
self.deck.db.executemany(
|
self.deck.db.executemany(
|
||||||
"update cards set type=2,queue=2,ivl=:ivl,due=:due where id=:id",
|
"update cards set type=2,queue=2,ivl=:ivl,due=:due where id=:id",
|
||||||
d)
|
d)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue