fix is:recent

This commit is contained in:
Damien Elmes 2012-01-24 01:04:49 +09:00
parent 766e153840
commit 4f1bcb9356

View file

@ -46,6 +46,13 @@ class Finder(object):
return [] return []
(q, args) = self._whereClause() (q, args) = self._whereClause()
order = self._order() order = self._order()
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 = """\ 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)
@ -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: