use type not queue for rev sib. spacing, fix cram case

This commit is contained in:
Damien Elmes 2012-03-11 14:52:12 +09:00
parent 4a12ec62c1
commit 8030b2c969
2 changed files with 12 additions and 2 deletions

View file

@ -703,7 +703,7 @@ did = ? and queue = 2 and due <= ? %s limit ?""" % order,
conf = self._revConf(card)
# find sibling positions
dues = self.col.db.list(
"select due from cards where nid = ? and queue = 2"
"select due from cards where nid = ? and type = 2"
" and id != ?", card.nid, card.id)
if not dues or idealDue not in dues:
return idealIvl
@ -864,7 +864,9 @@ did = ?, queue = %s, due = ?, mod = ?, usn = ? where id = ?""" % queue, data)
return dict(
# original deck
ease4=oconf['rev']['ease4'],
fi=oconf['rev']['fi']
fi=oconf['rev']['fi'],
minSpace=oconf['rev']['minSpace'],
fuzz=oconf['rev']['fuzz']
)
def _deckLimit(self):

View file

@ -508,6 +508,7 @@ def test_cram():
d.reset()
assert d.sched.counts() == (0,0,0)
c.due = 0
c.ivl = 100
c.flush()
d.reset()
assert d.sched.counts() == (0,0,1)
@ -521,6 +522,13 @@ def test_cram():
d.sched.rebuildDyn(did)
d.reset()
assert d.sched.counts() == (0,0,1)
# add a sibling so we can test minSpace, etc
c2 = copy.deepcopy(c)
c2.id = 123
c2.ord = 1
c2.due = 325
c2.col = c.col
c2.flush()
# should be able to answer it
c = d.sched.getCard()
d.sched.answerCard(c, 4)