mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 22:57:11 -05:00
tally lrn separately so we don't limit it with the rev limit
This commit is contained in:
parent
6f90e2c445
commit
e3a848b5b8
2 changed files with 19 additions and 16 deletions
|
|
@ -175,7 +175,7 @@ order by due""" % self._deckLimit(),
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def deckDueList(self):
|
def deckDueList(self):
|
||||||
"Returns [deckname, did, due, new]"
|
"Returns [deckname, did, rev, lrn, new]"
|
||||||
self._checkDay()
|
self._checkDay()
|
||||||
if self._clearOverdue:
|
if self._clearOverdue:
|
||||||
self.removeFailed(expiredOnly=True)
|
self.removeFailed(expiredOnly=True)
|
||||||
|
|
@ -204,7 +204,7 @@ order by due""" % self._deckLimit(),
|
||||||
rlim = min(rlim, lims[p][1])
|
rlim = min(rlim, lims[p][1])
|
||||||
rev = self._revForDeck(deck['id'], rlim)
|
rev = self._revForDeck(deck['id'], rlim)
|
||||||
# save to list
|
# save to list
|
||||||
data.append([deck['name'], deck['id'], lrn+rev, new])
|
data.append([deck['name'], deck['id'], rev, lrn, new])
|
||||||
# add deck as a parent
|
# add deck as a parent
|
||||||
lims[deck['name']] = [nlim, rlim]
|
lims[deck['name']] = [nlim, rlim]
|
||||||
return data
|
return data
|
||||||
|
|
@ -231,13 +231,15 @@ order by due""" % self._deckLimit(),
|
||||||
did = None
|
did = None
|
||||||
rev = 0
|
rev = 0
|
||||||
new = 0
|
new = 0
|
||||||
|
lrn = 0
|
||||||
children = []
|
children = []
|
||||||
for c in tail:
|
for c in tail:
|
||||||
if len(c[0]) == 1:
|
if len(c[0]) == 1:
|
||||||
# current node
|
# current node
|
||||||
did = c[1]
|
did = c[1]
|
||||||
rev += c[2]
|
rev += c[2]
|
||||||
new += c[3]
|
lrn += c[3]
|
||||||
|
new += c[4]
|
||||||
else:
|
else:
|
||||||
# set new string to tail
|
# set new string to tail
|
||||||
c[0] = c[0][1:]
|
c[0] = c[0][1:]
|
||||||
|
|
@ -246,13 +248,14 @@ order by due""" % self._deckLimit(),
|
||||||
# tally up children counts
|
# tally up children counts
|
||||||
for ch in children:
|
for ch in children:
|
||||||
rev += ch[2]
|
rev += ch[2]
|
||||||
new += ch[3]
|
lrn += ch[3]
|
||||||
|
new += ch[4]
|
||||||
# limit the counts to the deck's limits
|
# limit the counts to the deck's limits
|
||||||
conf = self.col.decks.confForDid(did)
|
conf = self.col.decks.confForDid(did)
|
||||||
if not conf['dyn']:
|
if not conf['dyn']:
|
||||||
rev = min(rev, conf['rev']['perDay'])
|
rev = min(rev, conf['rev']['perDay'])
|
||||||
new = min(new, conf['new']['perDay'])
|
new = min(new, conf['new']['perDay'])
|
||||||
tree.append((head, did, rev, new, children))
|
tree.append((head, did, rev, lrn, new, children))
|
||||||
return tuple(tree)
|
return tuple(tree)
|
||||||
|
|
||||||
# Getting the next card
|
# Getting the next card
|
||||||
|
|
|
||||||
|
|
@ -496,7 +496,7 @@ def test_cram():
|
||||||
d.sched.rebuildDyn(did)
|
d.sched.rebuildDyn(did)
|
||||||
d.reset()
|
d.reset()
|
||||||
# should appear as new in the deck list
|
# should appear as new in the deck list
|
||||||
assert sorted(d.sched.deckDueList())[0][3] == 1
|
assert sorted(d.sched.deckDueList())[0][4] == 1
|
||||||
# and should appear in the counts
|
# and should appear in the counts
|
||||||
assert d.sched.counts() == (1,0,0)
|
assert d.sched.counts() == (1,0,0)
|
||||||
# grab it and check estimates
|
# grab it and check estimates
|
||||||
|
|
@ -833,22 +833,22 @@ def test_deckDue():
|
||||||
d.reset()
|
d.reset()
|
||||||
assert len(d.decks.decks) == 5
|
assert len(d.decks.decks) == 5
|
||||||
cnts = d.sched.deckDueList()
|
cnts = d.sched.deckDueList()
|
||||||
assert cnts[0] == ["Default", 1, 0, 1]
|
assert cnts[0] == ["Default", 1, 0, 0, 1]
|
||||||
assert cnts[1] == ["Default::1", default1, 1, 0]
|
assert cnts[1] == ["Default::1", default1, 1, 0, 0]
|
||||||
assert cnts[2] == ["foo", d.decks.id("foo"), 0, 0]
|
assert cnts[2] == ["foo", d.decks.id("foo"), 0, 0, 0]
|
||||||
assert cnts[3] == ["foo::bar", foobar, 0, 1]
|
assert cnts[3] == ["foo::bar", foobar, 0, 0, 1]
|
||||||
assert cnts[4] == ["foo::baz", foobaz, 0, 1]
|
assert cnts[4] == ["foo::baz", foobaz, 0, 0, 1]
|
||||||
tree = d.sched.deckDueTree()
|
tree = d.sched.deckDueTree()
|
||||||
assert tree[0][0] == "Default"
|
assert tree[0][0] == "Default"
|
||||||
# sum of child and parent
|
# sum of child and parent
|
||||||
assert tree[0][1] == 1
|
assert tree[0][1] == 1
|
||||||
assert tree[0][2] == 1
|
assert tree[0][2] == 1
|
||||||
assert tree[0][3] == 1
|
assert tree[0][4] == 1
|
||||||
# child count is just review
|
# child count is just review
|
||||||
assert tree[0][4][0][0] == "1"
|
assert tree[0][5][0][0] == "1"
|
||||||
assert tree[0][4][0][1] == default1
|
assert tree[0][5][0][1] == default1
|
||||||
assert tree[0][4][0][2] == 1
|
assert tree[0][5][0][2] == 1
|
||||||
assert tree[0][4][0][3] == 0
|
assert tree[0][5][0][4] == 0
|
||||||
# code should not fail if a card has an invalid deck
|
# code should not fail if a card has an invalid deck
|
||||||
c.did = 12345; c.flush()
|
c.did = 12345; c.flush()
|
||||||
d.sched.deckDueList()
|
d.sched.deckDueList()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue