don't .reset() on deck load by default anymore

This commit is contained in:
Damien Elmes 2011-12-05 13:40:37 +09:00
parent e85603dae6
commit b99dbb1466
3 changed files with 8 additions and 6 deletions

View file

@ -7,6 +7,10 @@ Open a collection:
col = anki.open(path) col = anki.open(path)
Prepare scheduler, or reset scheduler after changes:
col.reset()
Get a due card: Get a due card:
card = col.sched.getCard() card = col.sched.getCard()
@ -21,10 +25,6 @@ Answer the card:
col.sched.answerCard(card, ease) col.sched.answerCard(card, ease)
Refresh after a change:
col.reset()
Edit the card: Edit the card:
note = card.note() note = card.note()

View file

@ -41,8 +41,6 @@ def Collection(path, queue=True, lock=True, server=False):
col.lock() col.lock()
if not queue: if not queue:
return col return col
# rebuild queue
col.reset()
return col return col
# no upgrades necessary at the moment # no upgrades necessary at the moment

View file

@ -8,10 +8,12 @@ from anki.consts import *
def test_basics(): def test_basics():
d = getEmptyDeck() d = getEmptyDeck()
d.reset()
assert not d.sched.getCard() assert not d.sched.getCard()
def test_new(): def test_new():
d = getEmptyDeck() d = getEmptyDeck()
d.reset()
assert d.sched.newCount == 0 assert d.sched.newCount == 0
# add a note # add a note
f = d.newNote() f = d.newNote()
@ -212,6 +214,7 @@ def test_reviews():
# failing it should put it in the learn queue with the default options # failing it should put it in the learn queue with the default options
################################################## ##################################################
# different delay to new # different delay to new
d.reset()
d.sched._cardConf(c)['lapse']['delays'] = [2, 20] d.sched._cardConf(c)['lapse']['delays'] = [2, 20]
d.sched.answerCard(c, 1) d.sched.answerCard(c, 1)
assert c.queue == 1 assert c.queue == 1
@ -292,6 +295,7 @@ def test_finished():
# have a new card # have a new card
assert "new cards available" in d.sched.finishedMsg() assert "new cards available" in d.sched.finishedMsg()
# turn it into a review # turn it into a review
d.reset()
c = f.cards()[0] c = f.cards()[0]
c.startTimer() c.startTimer()
d.sched.answerCard(c, 3) d.sched.answerCard(c, 3)