From 19fd581839755ac79b62680f6cf65462cca96e7f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 24 Apr 2011 12:26:12 +0900 Subject: [PATCH] change default lrn timing; leechAction doesn't need an array --- anki/deck.py | 2 +- anki/groups.py | 10 +++++----- anki/sched.py | 2 +- tests/test_sched.py | 7 +++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index 046788f4e..1cfa6936d 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -27,7 +27,7 @@ defaultQconf = { 'newOrder': 1, 'newSpread': NEW_CARDS_DISTRIBUTE, 'revOrder': REV_CARDS_RANDOM, - 'collapseTime': 600, + 'collapseTime': 1200, 'repLim': 0, 'timeLim': 600, } diff --git a/anki/groups.py b/anki/groups.py index bac8aab46..0c56c9617 100644 --- a/anki/groups.py +++ b/anki/groups.py @@ -7,21 +7,21 @@ from anki.utils import intTime defaultConf = { 'new': { - 'delays': [0.5, 3, 10], + 'delays': [1, 10], 'ints': [1, 7, 4], 'initialFactor': 2500, }, 'lapse': { - 'delays': [0.5, 3, 10], + 'delays': [1, 10], 'mult': 0, 'minInt': 1, 'relearn': True, 'leechFails': 16, - # [type, data], where type 0=suspend, 1=tagonly - 'leechAction': [0], + # type 0=suspend, 1=tagonly + 'leechAction': 0, }, 'cram': { - 'delays': [0.5, 3, 10], + 'delays': [1, 5, 10], 'resched': True, 'reset': True, 'mult': 0, diff --git a/anki/sched.py b/anki/sched.py index 3755fc7d1..1434aa10b 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -559,7 +559,7 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % ( f.addTag("leech") f.flush() # handle - a = conf['leechAction'][0] + a = conf['leechAction'] if a == 0: self.suspendCards([card.id]) card.queue = -1 diff --git a/tests/test_sched.py b/tests/test_sched.py index cf826e909..56a6d7d80 100644 --- a/tests/test_sched.py +++ b/tests/test_sched.py @@ -79,8 +79,7 @@ def test_newBoxes(): d.reset() c = d.sched.getCard() d.sched.answerCard(c, 2) - d.sched.answerCard(c, 2) - assert c.grade == 2 + assert c.grade == 1 d.sched._cardConf(c)['new']['delays'] = [0.5] # should handle gracefully d.sched.answerCard(c, 2) @@ -97,6 +96,7 @@ def test_learn(): # sched.getCard should return it, since it's due in the past c = d.sched.getCard() assert c + d.sched._cardConf(c)['new']['delays'] = [0.5, 3, 10] # it should have no cycles and a grade of 0 assert c.grade == c.cycles == 0 # fail it @@ -277,6 +277,8 @@ def test_nextIvl(): f['Front'] = u"one"; f['Back'] = u"two" d.addFact(f) c = f.cards()[0] + d.sched._cardConf(c)['new']['delays'] = [0.5, 3, 10] + d.sched._cardConf(c)['lapse']['delays'] = [0.5, 3, 10] # cards in learning ################################################## ni = d.sched.nextIvl @@ -394,6 +396,7 @@ def test_cram(): conf['resched'] = False assert d.sched.counts() == (1, 0, 0) c = d.sched.getCard() + d.sched._cardConf(c)['cram']['delays'] = [0.5, 3, 10] assert d.sched.counts() == (0, 0, 0) # check that estimates work assert d.sched.nextIvl(c, 1) == 30