mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
default to v2 scheduler on new installs, remove warning
This commit is contained in:
parent
bceb4feb5b
commit
3b5f8fec4c
8 changed files with 20 additions and 23 deletions
|
@ -47,6 +47,7 @@ defaultConf = {
|
||||||
'sortBackwards': False,
|
'sortBackwards': False,
|
||||||
'addToCur': True, # add new to currently selected deck?
|
'addToCur': True, # add new to currently selected deck?
|
||||||
'dayLearnFirst': False,
|
'dayLearnFirst': False,
|
||||||
|
'schedVer': 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
# this is initialized by storage.Collection
|
# this is initialized by storage.Collection
|
||||||
|
@ -84,11 +85,10 @@ class _Collection:
|
||||||
# Scheduler
|
# Scheduler
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
defaultSchedulerVersion = 1
|
|
||||||
supportedSchedulerVersions = (1, 2)
|
supportedSchedulerVersions = (1, 2)
|
||||||
|
|
||||||
def schedVer(self):
|
def schedVer(self):
|
||||||
ver = self.conf.get("schedVer", self.defaultSchedulerVersion)
|
ver = self.conf.get("schedVer", 1)
|
||||||
if ver in self.supportedSchedulerVersions:
|
if ver in self.supportedSchedulerVersions:
|
||||||
return ver
|
return ver
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -128,16 +128,14 @@ class Preferences(QDialog):
|
||||||
if haveNew == wantNew:
|
if haveNew == wantNew:
|
||||||
return
|
return
|
||||||
|
|
||||||
if haveNew and not wantNew:
|
if not askUser(_("This will reset any cards in learning, clear filtered decks, and change the scheduler version. Proceed?")):
|
||||||
if not askUser(_("This will reset any cards in learning, clear filtered decks, and change the scheduler version. Proceed?")):
|
return
|
||||||
return
|
|
||||||
|
if wantNew:
|
||||||
|
self.mw.col.changeSchedulerVer(2)
|
||||||
|
else:
|
||||||
self.mw.col.changeSchedulerVer(1)
|
self.mw.col.changeSchedulerVer(1)
|
||||||
return
|
|
||||||
|
|
||||||
if not askUser(_("The experimental scheduler could cause incorrect scheduling. Please ensure you have read the documentation first. Proceed?")):
|
|
||||||
return
|
|
||||||
|
|
||||||
self.mw.col.changeSchedulerVer(2)
|
|
||||||
|
|
||||||
# Day cutoff
|
# Day cutoff
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
|
@ -111,7 +111,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="newSched">
|
<widget class="QCheckBox" name="newSched">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Experimental V2 scheduler</string>
|
<string>New (V2) scheduler</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -12,7 +12,7 @@ def assertException(exception, func):
|
||||||
|
|
||||||
# Creating new decks is expensive. Just do it once, and then spin off
|
# Creating new decks is expensive. Just do it once, and then spin off
|
||||||
# copies from the master.
|
# copies from the master.
|
||||||
def getEmptyCol(schedVer=1):
|
def getEmptyCol():
|
||||||
if len(getEmptyCol.master) == 0:
|
if len(getEmptyCol.master) == 0:
|
||||||
(fd, nam) = tempfile.mkstemp(suffix=".anki2")
|
(fd, nam) = tempfile.mkstemp(suffix=".anki2")
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
@ -22,10 +22,7 @@ def getEmptyCol(schedVer=1):
|
||||||
getEmptyCol.master = nam
|
getEmptyCol.master = nam
|
||||||
(fd, nam) = tempfile.mkstemp(suffix=".anki2")
|
(fd, nam) = tempfile.mkstemp(suffix=".anki2")
|
||||||
shutil.copy(getEmptyCol.master, nam)
|
shutil.copy(getEmptyCol.master, nam)
|
||||||
from anki.collection import _Collection
|
|
||||||
_Collection.defaultSchedulerVersion = schedVer
|
|
||||||
col = aopen(nam)
|
col = aopen(nam)
|
||||||
_Collection.defaultSchedulerVersion = 1
|
|
||||||
return col
|
return col
|
||||||
|
|
||||||
getEmptyCol.master = ""
|
getEmptyCol.master = ""
|
||||||
|
|
|
@ -82,7 +82,7 @@ def test_export_ankipkg():
|
||||||
|
|
||||||
@nose.with_setup(setup1)
|
@nose.with_setup(setup1)
|
||||||
def test_export_anki_due():
|
def test_export_anki_due():
|
||||||
deck = getEmptyCol(schedVer=2)
|
deck = getEmptyCol()
|
||||||
f = deck.newNote()
|
f = deck.newNote()
|
||||||
f['Front'] = "foo"
|
f['Front'] = "foo"
|
||||||
deck.addNote(f)
|
deck.addNote(f)
|
||||||
|
|
|
@ -4,10 +4,14 @@ import time
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from anki.consts import STARTING_FACTOR
|
from anki.consts import STARTING_FACTOR
|
||||||
from tests.shared import getEmptyCol
|
from tests.shared import getEmptyCol as getEmptyColOrig
|
||||||
from anki.utils import intTime
|
from anki.utils import intTime
|
||||||
from anki.hooks import addHook
|
from anki.hooks import addHook
|
||||||
|
|
||||||
|
def getEmptyCol():
|
||||||
|
col = getEmptyColOrig()
|
||||||
|
col.changeSchedulerVer(1)
|
||||||
|
return col
|
||||||
|
|
||||||
def test_clock():
|
def test_clock():
|
||||||
d = getEmptyCol()
|
d = getEmptyCol()
|
||||||
|
|
|
@ -4,13 +4,10 @@ import time
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from anki.consts import STARTING_FACTOR
|
from anki.consts import STARTING_FACTOR
|
||||||
from tests.shared import getEmptyCol as _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
|
||||||
|
|
||||||
def getEmptyCol():
|
|
||||||
return _getEmptyCol(schedVer=2)
|
|
||||||
|
|
||||||
def test_clock():
|
def test_clock():
|
||||||
d = getEmptyCol()
|
d = getEmptyCol()
|
||||||
if (d.sched.dayCutoff - intTime()) < 10*60:
|
if (d.sched.dayCutoff - intTime()) < 10*60:
|
||||||
|
@ -1129,7 +1126,8 @@ def test_failmult():
|
||||||
assert c.ivl == 25
|
assert c.ivl == 25
|
||||||
|
|
||||||
def test_moveVersions():
|
def test_moveVersions():
|
||||||
col = _getEmptyCol(schedVer=1)
|
col = getEmptyCol()
|
||||||
|
col.changeSchedulerVer(1)
|
||||||
|
|
||||||
n = col.newNote()
|
n = col.newNote()
|
||||||
n['Front'] = "one"
|
n['Front'] = "one"
|
||||||
|
|
|
@ -36,7 +36,7 @@ def test_op():
|
||||||
assert d.undoName() == "Review"
|
assert d.undoName() == "Review"
|
||||||
|
|
||||||
def test_review():
|
def test_review():
|
||||||
d = getEmptyCol(schedVer=2)
|
d = getEmptyCol()
|
||||||
d.conf['counts'] = COUNT_REMAINING
|
d.conf['counts'] = COUNT_REMAINING
|
||||||
f = d.newNote()
|
f = d.newNote()
|
||||||
f['Front'] = "one"
|
f['Front'] = "one"
|
||||||
|
|
Loading…
Reference in a new issue