mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
fix is:recent
This commit is contained in:
parent
766e153840
commit
4f1bcb9356
1 changed files with 12 additions and 3 deletions
15
anki/find.py
15
anki/find.py
|
@ -46,7 +46,14 @@ class Finder(object):
|
||||||
return []
|
return []
|
||||||
(q, args) = self._whereClause()
|
(q, args) = self._whereClause()
|
||||||
order = self._order()
|
order = self._order()
|
||||||
query = """\
|
if self.lims['recent']:
|
||||||
|
query = """
|
||||||
|
select c.id from cards c, notes n where c.id in (
|
||||||
|
select id from cards c where %s limit 100)
|
||||||
|
and c.nid=n.id
|
||||||
|
%s""" % (q, order)
|
||||||
|
else:
|
||||||
|
query = """\
|
||||||
select c.id from cards c, notes n where %s
|
select c.id from cards c, notes n where %s
|
||||||
and c.nid=n.id %s""" % (q, order)
|
and c.nid=n.id %s""" % (q, order)
|
||||||
res = self.col.db.list(query, **args)
|
res = self.col.db.list(query, **args)
|
||||||
|
@ -97,7 +104,8 @@ and c.nid=n.id %s""" % (q, order)
|
||||||
self.lims = {
|
self.lims = {
|
||||||
'preds': [],
|
'preds': [],
|
||||||
'args': {},
|
'args': {},
|
||||||
'valid': True
|
'valid': True,
|
||||||
|
'recent': False,
|
||||||
}
|
}
|
||||||
for c, (token, isNeg, type) in enumerate(self._parseQuery()):
|
for c, (token, isNeg, type) in enumerate(self._parseQuery()):
|
||||||
if type == SEARCH_TAG:
|
if type == SEARCH_TAG:
|
||||||
|
@ -146,7 +154,8 @@ and c.nid=n.id %s""" % (q, order)
|
||||||
elif val == "due":
|
elif val == "due":
|
||||||
cond = "(queue = 2 and due <= %d)" % self.col.sched.today
|
cond = "(queue = 2 and due <= %d)" % self.col.sched.today
|
||||||
elif val == "recent":
|
elif val == "recent":
|
||||||
cond = "c.id in (select id from cards order by mod desc limit 100)"
|
self.lims['recent'] = True
|
||||||
|
return
|
||||||
if neg:
|
if neg:
|
||||||
cond = "not (%s)" % cond
|
cond = "not (%s)" % cond
|
||||||
if cond:
|
if cond:
|
||||||
|
|
Loading…
Reference in a new issue