- for t in Todo.matching(self.conn, comment_pattern):
- # pylint: disable=too-many-boolean-expressions
- if (start and t.date < start)\
- or (end and t.date > end)\
- or (process_id and t.process.id_ != process_id):
- continue
- todos += [t]
+ ret = Todo.by_date_range_with_limits(self.conn, (start, end))
+ todos_by_date_range, start, end = ret
+ todos = [t for t in todos_by_date_range
+ if comment_pattern in t.comment
+ and ((not process_id) or t.process.id_ == process_id)]