diff --git a/anki/deck.py b/anki/deck.py index 6d317be67..ac11ee20f 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -31,7 +31,7 @@ defaultQconf = { 'timeLim': 600, } -# scheduling and other options +# other options defaultConf = { 'currentModelId': None, 'currentGroupId': 1, @@ -52,7 +52,8 @@ defaultConf = { 'latexPost': "\\end{document}", 'fontFamilies': [ [u'MS 明朝',u'ヒラギノ明朝 Pro W3',u'Kochi Mincho', u'東風明朝'] - ] + ], + 'sortBackwards': False, } # this is initialized by storage.Deck diff --git a/anki/find.py b/anki/find.py index ba77548a5..81a935043 100644 --- a/anki/find.py +++ b/anki/find.py @@ -30,7 +30,10 @@ class Finder(object): return [] (q, args) = self._whereClause() query = self._orderedSelect(sort, q) - return self.deck.db.list(query, **args) + res = self.deck.db.list(query, **args) + if self.deck.conf['sortBackwards']: + res.reverse() + return res def _whereClause(self): x = [] diff --git a/tests/test_find.py b/tests/test_find.py index 9545573ac..91133b44a 100644 --- a/tests/test_find.py +++ b/tests/test_find.py @@ -84,6 +84,9 @@ def test_findCards(): assert deck.findCards("", sort="factFld")[0] == catCard.id assert deck.findCards("", sort="factFld")[-1] == c.id assert deck.findCards("", sort="cardMod")[-1] == c.id + assert not deck.findCards("", sort="cardMod")[0] == c.id + deck.conf['sortBackwards'] = True + assert deck.findCards("", sort="cardMod")[0] == c.id # model assert len(deck.findCards("model:basic")) == 5 assert len(deck.findCards("-model:basic")) == 0