mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 23:27:12 -05:00
drop the count_answered option
This commit is contained in:
parent
3e5041f337
commit
dac46752ed
3 changed files with 1 additions and 55 deletions
|
|
@ -24,7 +24,6 @@ defaultConf = {
|
|||
'topGroup': 1,
|
||||
'curGroup': None,
|
||||
'revOrder': REV_CARDS_RANDOM,
|
||||
'counts': COUNT_REMAINING,
|
||||
# other config
|
||||
'nextPos': 1,
|
||||
'fontFamilies': [
|
||||
|
|
|
|||
|
|
@ -67,18 +67,8 @@ class Scheduler(object):
|
|||
|
||||
def counts(self):
|
||||
"Does not include fetched but unanswered."
|
||||
if self.deck.conf['counts'] == COUNT_REMAINING:
|
||||
return self.dueCounts()
|
||||
else:
|
||||
return self.answeredCounts()
|
||||
|
||||
def dueCounts(self):
|
||||
return (self.newCount, self.lrnCount, self.revCount)
|
||||
|
||||
def answeredCounts(self):
|
||||
t = self.deck.groups.top()
|
||||
return (t['newToday'][1], t['lrnToday'][1], t['revToday'][1])
|
||||
|
||||
def dueForecast(self, days=7):
|
||||
"Return counts over next DAYS. Includes today."
|
||||
daysd = dict(self.deck.db.all("""
|
||||
|
|
@ -740,7 +730,7 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % (
|
|||
|
||||
def repsToday(self):
|
||||
"Number of cards answered today."
|
||||
return sum(self.answeredCounts())
|
||||
return sum(self.counts())
|
||||
|
||||
# Dynamic indices
|
||||
##########################################################################
|
||||
|
|
|
|||
|
|
@ -586,48 +586,8 @@ def test_ordcycle():
|
|||
assert d.sched.getCard().ord == 1
|
||||
assert d.sched.getCard().ord == 2
|
||||
|
||||
def test_counts_up():
|
||||
d = getEmptyDeck()
|
||||
d.conf['counts'] = COUNT_ANSWERED
|
||||
# for each card type
|
||||
for type in range(3):
|
||||
# create a new fact
|
||||
f = d.newFact()
|
||||
f['Front'] = u"one"
|
||||
d.addFact(f)
|
||||
c = f.cards()[0]
|
||||
# set type/gid
|
||||
c.type = type
|
||||
c.queue = type
|
||||
c.due = 0
|
||||
c.flush()
|
||||
d.reset()
|
||||
# all zeros first
|
||||
assert d.sched.counts() == (0,0,0)
|
||||
# answer the first card, which is a lrn one
|
||||
c = d.sched.getCard()
|
||||
assert c.queue == 1
|
||||
d.sched.answerCard(c, 4)
|
||||
assert d.sched.counts() == (0,1,0)
|
||||
# and the next, which is a rev card
|
||||
c = d.sched.getCard()
|
||||
assert c.queue == 2
|
||||
d.sched.answerCard(c, 4)
|
||||
assert d.sched.counts() == (0,1,1)
|
||||
# and the last, which is a new one
|
||||
c = d.sched.getCard()
|
||||
assert c.queue == 0
|
||||
d.sched.answerCard(c, 4)
|
||||
assert d.sched.counts() == (1,1,1)
|
||||
# total should match
|
||||
assert d.sched.repsToday() == 3
|
||||
# the time should have been updated as well, but it gets rounded to zero
|
||||
# in the test so we need to grab it manually
|
||||
assert d.groups.top()['timeToday'][1]
|
||||
|
||||
def test_counts_down():
|
||||
d = getEmptyDeck()
|
||||
d.conf['counts'] = COUNT_REMAINING
|
||||
# add a second group
|
||||
grp = d.groups.id("new group")
|
||||
# for each card type
|
||||
|
|
@ -655,7 +615,6 @@ def test_counts_down():
|
|||
|
||||
def test_counts_idx():
|
||||
d = getEmptyDeck()
|
||||
d.conf['counts'] = COUNT_REMAINING
|
||||
f = d.newFact()
|
||||
f['Front'] = u"one"; f['Back'] = u"two"
|
||||
d.addFact(f)
|
||||
|
|
@ -718,7 +677,6 @@ def test_collapse():
|
|||
|
||||
def test_groupCounts():
|
||||
d = getEmptyDeck()
|
||||
d.conf['counts'] = COUNT_REMAINING
|
||||
# add a fact with default group
|
||||
f = d.newFact()
|
||||
f['Front'] = u"one"
|
||||
|
|
@ -808,7 +766,6 @@ def test_reorder():
|
|||
|
||||
def test_forget():
|
||||
d = getEmptyDeck()
|
||||
d.conf['counts'] = COUNT_REMAINING
|
||||
f = d.newFact()
|
||||
f['Front'] = u"one"
|
||||
d.addFact(f)
|
||||
|
|
|
|||
Loading…
Reference in a new issue