Skip to content
Snippets Groups Projects
Commit 085c286e authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-190: added static method to get a QuerySet for subtasks with no predecessors

parent 1245278a
No related branches found
No related tags found
1 merge request!252Resolve TMSS-190
......@@ -173,6 +173,13 @@ class Subtask(BasicCommon):
msg.subject, tobus.exchange, address[0], address[1], single_line_with_single_spaces(msg.content))
tobus.send(msg)
@staticmethod
def independent_subtasks() -> QuerySet:
'''return a QuerySet of all subtasks with no input (i.e. which are "independent" because they have no predecessors)
If you want the result, add .all() like so: Subtask.independent_subtasks().all()
'''
return Subtask.objects.filter(inputs=None)
@property
def successors(self) -> QuerySet:
'''return the connect successor subtask(s) as queryset (over which you can perform extended queries, or return via the serializers/viewsets)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment