List only tasks that are leaves on the task tree
This commit is contained in:
parent
8fa3551ed6
commit
b8c3c28bcd
@ -85,7 +85,11 @@ def show_by_id(session: sa.orm.Session, index: int):
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def ls(session: sa.orm.Session, _all: False):
|
||||
vals = session.query(Task).order_by(Task.created_at)
|
||||
vals = session.query(Task)
|
||||
# We must be the final task in a series
|
||||
vals = vals.filter(~sa.exists().where(Task.id == depends_association.c.second_id))
|
||||
vals = vals.order_by(Task.created_at)
|
||||
|
||||
if _all is False:
|
||||
vals = vals.filter(Task.active == True) # noqa
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user