mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
revert to noteCrt if sort order invalid
This commit is contained in:
parent
f0a0df5a29
commit
7cec4762eb
1 changed files with 4 additions and 6 deletions
10
anki/find.py
10
anki/find.py
|
@ -208,6 +208,7 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
|
||||||
return " order by " + order, False
|
return " order by " + order, False
|
||||||
# use deck default
|
# use deck default
|
||||||
type = self.col.conf['sortType']
|
type = self.col.conf['sortType']
|
||||||
|
sort = None
|
||||||
if type.startswith("note"):
|
if type.startswith("note"):
|
||||||
if type == "noteCrt":
|
if type == "noteCrt":
|
||||||
sort = "n.id, c.ord"
|
sort = "n.id, c.ord"
|
||||||
|
@ -215,8 +216,6 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
|
||||||
sort = "n.mod, c.ord"
|
sort = "n.mod, c.ord"
|
||||||
elif type == "noteFld":
|
elif type == "noteFld":
|
||||||
sort = "n.sfld collate nocase, c.ord"
|
sort = "n.sfld collate nocase, c.ord"
|
||||||
else:
|
|
||||||
raise Exception()
|
|
||||||
elif type.startswith("card"):
|
elif type.startswith("card"):
|
||||||
if type == "cardMod":
|
if type == "cardMod":
|
||||||
sort = "c.mod"
|
sort = "c.mod"
|
||||||
|
@ -230,10 +229,9 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
|
||||||
sort = "c.lapses"
|
sort = "c.lapses"
|
||||||
elif type == "cardIvl":
|
elif type == "cardIvl":
|
||||||
sort = "c.ivl"
|
sort = "c.ivl"
|
||||||
else:
|
if not sort:
|
||||||
raise Exception()
|
# deck has invalid sort order; revert to noteCrt
|
||||||
else:
|
sort = "n.id, c.ord"
|
||||||
raise Exception()
|
|
||||||
return " order by " + sort, self.col.conf['sortBackwards']
|
return " order by " + sort, self.col.conf['sortBackwards']
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
|
|
Loading…
Reference in a new issue