use a constant for the starting factor
This commit is contained in:
parent
18ccf26a2e
commit
227ca090db
@ -44,6 +44,8 @@ DYN_MAX_SIZE = 99999
|
|||||||
MODEL_STD = 0
|
MODEL_STD = 0
|
||||||
MODEL_CLOZE = 1
|
MODEL_CLOZE = 1
|
||||||
|
|
||||||
|
STARTING_FACTOR = 2500
|
||||||
|
|
||||||
# deck schema & syncing vars
|
# deck schema & syncing vars
|
||||||
SCHEMA_VERSION = 11
|
SCHEMA_VERSION = 11
|
||||||
SYNC_ZIP_SIZE = int(2.5*1024*1024)
|
SYNC_ZIP_SIZE = int(2.5*1024*1024)
|
||||||
|
@ -49,7 +49,7 @@ defaultConf = {
|
|||||||
'new': {
|
'new': {
|
||||||
'delays': [1, 10],
|
'delays': [1, 10],
|
||||||
'ints': [1, 4, 7], # 7 is not currently used
|
'ints': [1, 4, 7], # 7 is not currently used
|
||||||
'initialFactor': 2500,
|
'initialFactor': STARTING_FACTOR,
|
||||||
'separate': True,
|
'separate': True,
|
||||||
'order': NEW_CARDS_DUE,
|
'order': NEW_CARDS_DUE,
|
||||||
'perDay': 20,
|
'perDay': 20,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import cgi
|
import cgi
|
||||||
from anki.consts import NEW_CARDS_RANDOM
|
from anki.consts import NEW_CARDS_RANDOM, STARTING_FACTOR
|
||||||
from anki.lang import _
|
from anki.lang import _
|
||||||
from anki.utils import fieldChecksum, guid64, timestampID, \
|
from anki.utils import fieldChecksum, guid64, timestampID, \
|
||||||
joinFields, intTime, splitFields
|
joinFields, intTime, splitFields
|
||||||
@ -25,7 +25,7 @@ class ForeignCard(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.due = 0
|
self.due = 0
|
||||||
self.ivl = 1
|
self.ivl = 1
|
||||||
self.factor = 2500
|
self.factor = STARTING_FACTOR
|
||||||
self.reps = 0
|
self.reps = 0
|
||||||
self.lapses = 0
|
self.lapses = 0
|
||||||
|
|
||||||
|
@ -1338,7 +1338,7 @@ and (queue=0 or (queue=2 and due<=?))""",
|
|||||||
self.remFromDyn(ids)
|
self.remFromDyn(ids)
|
||||||
self.col.db.execute(
|
self.col.db.execute(
|
||||||
"update cards set type=0,queue=0,ivl=0,due=0,odue=0,factor=?"
|
"update cards set type=0,queue=0,ivl=0,due=0,odue=0,factor=?"
|
||||||
" where id in "+ids2str(ids), 2500)
|
" where id in "+ids2str(ids), STARTING_FACTOR)
|
||||||
pmax = self.col.db.scalar(
|
pmax = self.col.db.scalar(
|
||||||
"select max(due) from cards where type=0") or 0
|
"select max(due) from cards where type=0") or 0
|
||||||
# takes care of mod + usn
|
# takes care of mod + usn
|
||||||
@ -1353,7 +1353,7 @@ and (queue=0 or (queue=2 and due<=?))""",
|
|||||||
for id in ids:
|
for id in ids:
|
||||||
r = random.randint(imin, imax)
|
r = random.randint(imin, imax)
|
||||||
d.append(dict(id=id, due=r+t, ivl=max(1, r), mod=mod,
|
d.append(dict(id=id, due=r+t, ivl=max(1, r), mod=mod,
|
||||||
usn=self.col.usn(), fact=2500))
|
usn=self.col.usn(), fact=STARTING_FACTOR))
|
||||||
self.remFromDyn(ids)
|
self.remFromDyn(ids)
|
||||||
self.col.db.executemany("""
|
self.col.db.executemany("""
|
||||||
update cards set type=2,queue=2,ivl=:ivl,due=:due,odue=0,
|
update cards set type=2,queue=2,ivl=:ivl,due=:due,odue=0,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import time
|
import time
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
from anki.consts import STARTING_FACTOR
|
||||||
from tests.shared import getEmptyCol
|
from tests.shared import getEmptyCol
|
||||||
from anki.utils import intTime
|
from anki.utils import intTime
|
||||||
from anki.hooks import addHook
|
from anki.hooks import addHook
|
||||||
@ -278,7 +279,7 @@ def test_reviews():
|
|||||||
c.type = 2
|
c.type = 2
|
||||||
c.queue = 2
|
c.queue = 2
|
||||||
c.due = d.sched.today - 8
|
c.due = d.sched.today - 8
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
c.reps = 3
|
c.reps = 3
|
||||||
c.lapses = 1
|
c.lapses = 1
|
||||||
c.ivl = 100
|
c.ivl = 100
|
||||||
@ -332,7 +333,7 @@ def test_reviews():
|
|||||||
assert checkRevIvl(d, c, 260)
|
assert checkRevIvl(d, c, 260)
|
||||||
assert c.due == d.sched.today + c.ivl
|
assert c.due == d.sched.today + c.ivl
|
||||||
# factor should have been left alone
|
# factor should have been left alone
|
||||||
assert c.factor == 2500
|
assert c.factor == STARTING_FACTOR
|
||||||
# ease 4
|
# ease 4
|
||||||
##################################################
|
##################################################
|
||||||
c = copy.copy(cardcopy)
|
c = copy.copy(cardcopy)
|
||||||
@ -393,7 +394,7 @@ def test_overdue_lapse():
|
|||||||
c.queue = 1
|
c.queue = 1
|
||||||
c.due = -1
|
c.due = -1
|
||||||
c.odue = -1
|
c.odue = -1
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
c.left = 2002
|
c.left = 2002
|
||||||
c.ivl = 0
|
c.ivl = 0
|
||||||
c.flush()
|
c.flush()
|
||||||
@ -467,7 +468,7 @@ def test_nextIvl():
|
|||||||
##################################################
|
##################################################
|
||||||
c.type = 2
|
c.type = 2
|
||||||
c.ivl = 100
|
c.ivl = 100
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
assert ni(c, 1) == 60
|
assert ni(c, 1) == 60
|
||||||
assert ni(c, 2) == 100*86400
|
assert ni(c, 2) == 100*86400
|
||||||
assert ni(c, 3) == 100*86400
|
assert ni(c, 3) == 100*86400
|
||||||
@ -475,7 +476,7 @@ def test_nextIvl():
|
|||||||
##################################################
|
##################################################
|
||||||
c.queue = 2
|
c.queue = 2
|
||||||
c.ivl = 100
|
c.ivl = 100
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
# failing it should put it at 60s
|
# failing it should put it at 60s
|
||||||
assert ni(c, 1) == 60
|
assert ni(c, 1) == 60
|
||||||
# or 1 day if relearn is false
|
# or 1 day if relearn is false
|
||||||
@ -557,7 +558,7 @@ def test_cram():
|
|||||||
# due in 25 days, so it's been waiting 75 days
|
# due in 25 days, so it's been waiting 75 days
|
||||||
c.due = d.sched.today + 25
|
c.due = d.sched.today + 25
|
||||||
c.mod = 1
|
c.mod = 1
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
c.startTimer()
|
c.startTimer()
|
||||||
c.flush()
|
c.flush()
|
||||||
d.reset()
|
d.reset()
|
||||||
@ -699,7 +700,7 @@ def test_cram_resched():
|
|||||||
c.ivl = 100
|
c.ivl = 100
|
||||||
c.type = c.queue = 2
|
c.type = c.queue = 2
|
||||||
c.due = d.sched.today + 25
|
c.due = d.sched.today + 25
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
c.flush()
|
c.flush()
|
||||||
cardcopy = copy.copy(c)
|
cardcopy = copy.copy(c)
|
||||||
d.sched.rebuildDyn(did)
|
d.sched.rebuildDyn(did)
|
||||||
@ -1078,7 +1079,7 @@ def test_norelearn():
|
|||||||
c.type = 2
|
c.type = 2
|
||||||
c.queue = 2
|
c.queue = 2
|
||||||
c.due = 0
|
c.due = 0
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
c.reps = 3
|
c.reps = 3
|
||||||
c.lapses = 1
|
c.lapses = 1
|
||||||
c.ivl = 100
|
c.ivl = 100
|
||||||
@ -1099,7 +1100,7 @@ def test_failmult():
|
|||||||
c.queue = 2
|
c.queue = 2
|
||||||
c.ivl = 100
|
c.ivl = 100
|
||||||
c.due = d.sched.today - c.ivl
|
c.due = d.sched.today - c.ivl
|
||||||
c.factor = 2500
|
c.factor = STARTING_FACTOR
|
||||||
c.reps = 3
|
c.reps = 3
|
||||||
c.lapses = 1
|
c.lapses = 1
|
||||||
c.startTimer()
|
c.startTimer()
|
||||||
|
@ -5,6 +5,7 @@ import nose, os, shutil, time
|
|||||||
from anki import Collection as aopen, Collection
|
from anki import Collection as aopen, Collection
|
||||||
from anki.utils import intTime
|
from anki.utils import intTime
|
||||||
from anki.sync import Syncer, LocalServer
|
from anki.sync import Syncer, LocalServer
|
||||||
|
from anki.consts import STARTING_FACTOR
|
||||||
from tests.shared import getEmptyCol, getEmptyDeckWith
|
from tests.shared import getEmptyCol, getEmptyDeckWith
|
||||||
|
|
||||||
# Local tests
|
# Local tests
|
||||||
@ -343,7 +344,7 @@ def test_filtered_delete():
|
|||||||
card = note.cards()[0]
|
card = note.cards()[0]
|
||||||
card.type = 2
|
card.type = 2
|
||||||
card.ivl = 10
|
card.ivl = 10
|
||||||
card.factor = 2500
|
card.factor = STARTING_FACTOR
|
||||||
card.due = deck1.sched.today
|
card.due = deck1.sched.today
|
||||||
card.flush()
|
card.flush()
|
||||||
# put cards into a filtered deck
|
# put cards into a filtered deck
|
||||||
|
Loading…
Reference in New Issue
Block a user