mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52: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,
|
||||
'addToCur': True, # add new to currently selected deck?
|
||||
'dayLearnFirst': False,
|
||||
'schedVer': 2,
|
||||
}
|
||||
|
||||
# this is initialized by storage.Collection
|
||||
|
@ -84,11 +85,10 @@ class _Collection:
|
|||
# Scheduler
|
||||
##########################################################################
|
||||
|
||||
defaultSchedulerVersion = 1
|
||||
supportedSchedulerVersions = (1, 2)
|
||||
|
||||
def schedVer(self):
|
||||
ver = self.conf.get("schedVer", self.defaultSchedulerVersion)
|
||||
ver = self.conf.get("schedVer", 1)
|
||||
if ver in self.supportedSchedulerVersions:
|
||||
return ver
|
||||
else:
|
||||
|
|
|
@ -128,16 +128,14 @@ class Preferences(QDialog):
|
|||
if haveNew == wantNew:
|
||||
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?")):
|
||||
return
|
||||
if not askUser(_("This will reset any cards in learning, clear filtered decks, and change the scheduler version. Proceed?")):
|
||||
return
|
||||
|
||||
if wantNew:
|
||||
self.mw.col.changeSchedulerVer(2)
|
||||
else:
|
||||
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
|
||||
######################################################################
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="newSched">
|
||||
<property name="text">
|
||||
<string>Experimental V2 scheduler</string>
|
||||
<string>New (V2) scheduler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -12,7 +12,7 @@ def assertException(exception, func):
|
|||
|
||||
# Creating new decks is expensive. Just do it once, and then spin off
|
||||
# copies from the master.
|
||||
def getEmptyCol(schedVer=1):
|
||||
def getEmptyCol():
|
||||
if len(getEmptyCol.master) == 0:
|
||||
(fd, nam) = tempfile.mkstemp(suffix=".anki2")
|
||||
os.close(fd)
|
||||
|
@ -22,10 +22,7 @@ def getEmptyCol(schedVer=1):
|
|||
getEmptyCol.master = nam
|
||||
(fd, nam) = tempfile.mkstemp(suffix=".anki2")
|
||||
shutil.copy(getEmptyCol.master, nam)
|
||||
from anki.collection import _Collection
|
||||
_Collection.defaultSchedulerVersion = schedVer
|
||||
col = aopen(nam)
|
||||
_Collection.defaultSchedulerVersion = 1
|
||||
return col
|
||||
|
||||
getEmptyCol.master = ""
|
||||
|
|
|
@ -82,7 +82,7 @@ def test_export_ankipkg():
|
|||
|
||||
@nose.with_setup(setup1)
|
||||
def test_export_anki_due():
|
||||
deck = getEmptyCol(schedVer=2)
|
||||
deck = getEmptyCol()
|
||||
f = deck.newNote()
|
||||
f['Front'] = "foo"
|
||||
deck.addNote(f)
|
||||
|
|
|
@ -4,10 +4,14 @@ import time
|
|||
import copy
|
||||
|
||||
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.hooks import addHook
|
||||
|
||||
def getEmptyCol():
|
||||
col = getEmptyColOrig()
|
||||
col.changeSchedulerVer(1)
|
||||
return col
|
||||
|
||||
def test_clock():
|
||||
d = getEmptyCol()
|
||||
|
|
|
@ -4,13 +4,10 @@ import time
|
|||
import copy
|
||||
|
||||
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.hooks import addHook
|
||||
|
||||
def getEmptyCol():
|
||||
return _getEmptyCol(schedVer=2)
|
||||
|
||||
def test_clock():
|
||||
d = getEmptyCol()
|
||||
if (d.sched.dayCutoff - intTime()) < 10*60:
|
||||
|
@ -1129,7 +1126,8 @@ def test_failmult():
|
|||
assert c.ivl == 25
|
||||
|
||||
def test_moveVersions():
|
||||
col = _getEmptyCol(schedVer=1)
|
||||
col = getEmptyCol()
|
||||
col.changeSchedulerVer(1)
|
||||
|
||||
n = col.newNote()
|
||||
n['Front'] = "one"
|
||||
|
|
|
@ -36,7 +36,7 @@ def test_op():
|
|||
assert d.undoName() == "Review"
|
||||
|
||||
def test_review():
|
||||
d = getEmptyCol(schedVer=2)
|
||||
d = getEmptyCol()
|
||||
d.conf['counts'] = COUNT_REMAINING
|
||||
f = d.newNote()
|
||||
f['Front'] = "one"
|
||||
|
|
Loading…
Reference in a new issue