mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
replace old selective study with new lists; fix upgrade
- instead of the old 4 settings, we move to just two, as there's no point having separate include and exclude options for a non-overlapping set of cards - revGroups and newGroups are a list of groupIds to include in the queue. If all groups are enabled, the UI should set it to an empty list rather than a list of every available group, and groupLimit() will leave off the constraint completely
This commit is contained in:
parent
4c931e0ff4
commit
7694ff81c5
3 changed files with 14 additions and 33 deletions
|
@ -32,10 +32,8 @@ import anki.models, anki.facts, anki.cards, anki.media, anki.groups, anki.graves
|
||||||
# Settings related to queue building. These may be loaded without the rest of
|
# Settings related to queue building. These may be loaded without the rest of
|
||||||
# the config to check due counts faster on mobile clients.
|
# the config to check due counts faster on mobile clients.
|
||||||
defaultQconf = {
|
defaultQconf = {
|
||||||
'newActive': u"",
|
'revGroups': [],
|
||||||
'newInactive': u"",
|
'newGroups': [],
|
||||||
'revActive': u"",
|
|
||||||
'revInactive': u"",
|
|
||||||
'newPerDay': 20,
|
'newPerDay': 20,
|
||||||
'newToday': [0, 0], # currentDay, count
|
'newToday': [0, 0], # currentDay, count
|
||||||
'newTodayOrder': NEW_TODAY_ORDINAL,
|
'newTodayOrder': NEW_TODAY_ORDINAL,
|
||||||
|
|
|
@ -477,31 +477,11 @@ and queue between 1 and 2""",
|
||||||
"update cards set queue = type where queue = -3")
|
"update cards set queue = type where queue = -3")
|
||||||
|
|
||||||
def groupLimit(self, type):
|
def groupLimit(self, type):
|
||||||
#return " and groupId in (1)"
|
l = self.deck.qconf[type+"Groups"]
|
||||||
print "fixme: groupLimit()"
|
if not l:
|
||||||
|
# everything
|
||||||
return ""
|
return ""
|
||||||
|
return " and groupId in %s" % ids2str(l)
|
||||||
def cardLimit(self, active, inactive, sql):
|
|
||||||
yes = parseTags(self.deck.qconf.get(active))
|
|
||||||
no = parseTags(self.deck.qconf.get(inactive))
|
|
||||||
if yes:
|
|
||||||
yids = tagIds(self.db, yes).values()
|
|
||||||
nids = tagIds(self.db, no).values()
|
|
||||||
return sql.replace(
|
|
||||||
"where",
|
|
||||||
"where +c.id in (select cardId from cardTags where "
|
|
||||||
"tagId in %s) and +c.id not in (select cardId from "
|
|
||||||
"cardTags where tagId in %s) and" % (
|
|
||||||
ids2str(yids),
|
|
||||||
ids2str(nids)))
|
|
||||||
elif no:
|
|
||||||
nids = tagIds(self.db, no).values()
|
|
||||||
return sql.replace(
|
|
||||||
"where",
|
|
||||||
"where +c.id not in (select cardId from cardTags where "
|
|
||||||
"tagId in %s) and" % ids2str(nids))
|
|
||||||
else:
|
|
||||||
return sql
|
|
||||||
|
|
||||||
# Daily cutoff
|
# Daily cutoff
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
|
@ -95,19 +95,22 @@ ifnull(syncName, ""), lastSync, utcOffset, "", "", "" from decks""")
|
||||||
keys = ("newActive", "newInactive", "revActive", "revInactive")
|
keys = ("newActive", "newInactive", "revActive", "revInactive")
|
||||||
for k in keys:
|
for k in keys:
|
||||||
s.execute("delete from deckVars where key=:k", {'k':k})
|
s.execute("delete from deckVars where key=:k", {'k':k})
|
||||||
|
# copy other settings
|
||||||
|
keys = ("newCardOrder", "newCardSpacing", "revCardOrder")
|
||||||
|
for k in keys:
|
||||||
|
qconf[k] = s.execute("select %s from decks" % k).scalar()
|
||||||
qconf['newPerDay'] = s.execute(
|
qconf['newPerDay'] = s.execute(
|
||||||
"select newCardsPerDay from decks").scalar()
|
"select newCardsPerDay from decks").scalar()
|
||||||
# fetch remaining settings from decks table
|
# fetch remaining settings from decks table
|
||||||
conf = deck.defaultConf.copy()
|
conf = deck.defaultConf.copy()
|
||||||
data = {}
|
data = {}
|
||||||
keys = ("newCardOrder", "newCardSpacing", "revCardOrder",
|
keys = ("sessionRepLimit", "sessionTimeLimit")
|
||||||
"sessionRepLimit", "sessionTimeLimit")
|
|
||||||
for k in keys:
|
for k in keys:
|
||||||
conf[k] = s.execute("select %s from decks" % k).scalar()
|
conf[k] = s.execute("select %s from decks" % k).scalar()
|
||||||
# random and due options merged
|
# random and due options merged
|
||||||
conf['revCardOrder'] = min(2, conf['revCardOrder'])
|
qconf['revCardOrder'] = min(2, qconf['revCardOrder'])
|
||||||
# no reverse option anymore
|
# no reverse option anymore
|
||||||
conf['newCardOrder'] = min(1, conf['newCardOrder'])
|
qconf['newCardOrder'] = min(1, qconf['newCardOrder'])
|
||||||
# add any deck vars and save
|
# add any deck vars and save
|
||||||
dkeys = ("hexCache", "cssCache")
|
dkeys = ("hexCache", "cssCache")
|
||||||
for (k, v) in s.execute("select * from deckVars").fetchall():
|
for (k, v) in s.execute("select * from deckVars").fetchall():
|
||||||
|
|
Loading…
Reference in a new issue