mirror of
https://github.com/ankitects/anki.git
synced 2025-12-15 15:50:59 -05:00
automatically remove from filtered deck before reschedule
commit 79ed57a445 prevented reschedule
on cards in a filtered deck, but it is more user friendly to
automatically move back to the home deck instead. we also don't need
to removeLrn() for review cards, because we're updating type+queue+odue
ourselves
This commit is contained in:
parent
99d82c1f2d
commit
19b1446758
2 changed files with 12 additions and 6 deletions
|
|
@ -1333,9 +1333,10 @@ and (queue=0 or (queue=2 and due<=?))""",
|
||||||
|
|
||||||
def forgetCards(self, ids):
|
def forgetCards(self, ids):
|
||||||
"Put cards at the end of the new queue."
|
"Put cards at the end of the new queue."
|
||||||
|
self.remFromDyn(ids)
|
||||||
self.col.db.execute(
|
self.col.db.execute(
|
||||||
"update cards set type=0,queue=0,ivl=0,due=0,odue=0,factor=? where odid=0 "
|
"update cards set type=0,queue=0,ivl=0,due=0,odue=0,factor=?"
|
||||||
"and queue >= 0 and id in "+ids2str(ids), 2500)
|
" where id in "+ids2str(ids), 2500)
|
||||||
pmax = self.col.db.scalar(
|
pmax = self.col.db.scalar(
|
||||||
"select max(due) from cards where type=0") or 0
|
"select max(due) from cards where type=0") or 0
|
||||||
# takes care of mod + usn
|
# takes care of mod + usn
|
||||||
|
|
@ -1351,10 +1352,10 @@ and (queue=0 or (queue=2 and due<=?))""",
|
||||||
r = random.randint(imin, imax)
|
r = random.randint(imin, imax)
|
||||||
d.append(dict(id=id, due=r+t, ivl=max(1, r), mod=mod,
|
d.append(dict(id=id, due=r+t, ivl=max(1, r), mod=mod,
|
||||||
usn=self.col.usn(), fact=2500))
|
usn=self.col.usn(), fact=2500))
|
||||||
self.removeLrn(ids)
|
self.remFromDyn(ids)
|
||||||
self.col.db.executemany("""
|
self.col.db.executemany("""
|
||||||
update cards set type=2,queue=2,ivl=:ivl,due=:due,
|
update cards set type=2,queue=2,ivl=:ivl,due=:due,odue=0,
|
||||||
usn=:usn, mod=:mod, factor=:fact where id=:id and odid=0 and queue >=0""",
|
usn=:usn,mod=:mod,factor=:fact where id=:id""",
|
||||||
d)
|
d)
|
||||||
self.col.log(ids)
|
self.col.log(ids)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import time, copy, sys
|
import time
|
||||||
|
import copy
|
||||||
|
|
||||||
from tests.shared import getEmptyDeck
|
from tests.shared import getEmptyDeck
|
||||||
from anki.utils import intTime
|
from anki.utils import intTime
|
||||||
from anki.hooks import addHook
|
from anki.hooks import addHook
|
||||||
|
|
||||||
|
|
||||||
def test_clock():
|
def test_clock():
|
||||||
d = getEmptyDeck()
|
d = getEmptyDeck()
|
||||||
if (d.sched.dayCutoff - intTime()) < 10*60:
|
if (d.sched.dayCutoff - intTime()) < 10*60:
|
||||||
|
|
@ -173,8 +176,10 @@ def test_learn():
|
||||||
c.queue = 1
|
c.queue = 1
|
||||||
c.odue = 321
|
c.odue = 321
|
||||||
c.flush()
|
c.flush()
|
||||||
|
print "----begin"
|
||||||
d.sched.removeLrn()
|
d.sched.removeLrn()
|
||||||
c.load()
|
c.load()
|
||||||
|
print c.__dict__
|
||||||
assert c.queue == 2
|
assert c.queue == 2
|
||||||
assert c.due == 321
|
assert c.due == 321
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue