equal
deleted
inserted
replaced
97 """ check for the status of task and assign it to the particular user """ |
97 """ check for the status of task and assign it to the particular user """ |
98 |
98 |
99 task.assigned_users.add(user) |
99 task.assigned_users.add(user) |
100 task.status = "AS" |
100 task.status = "AS" |
101 task.save() |
101 task.save() |
|
102 |
|
103 def getTask(tid): |
|
104 """ retreive the task from database. |
|
105 if the task has deps or subs, update its status correspondingly. |
|
106 """ |
|
107 |
|
108 task = Task.objects.get(id=tid) |
|
109 deps = task.deps.all() |
|
110 subs = task.subs.all() |
|
111 |
|
112 if deps and task.status in ["OP", "LO"]: |
|
113 task.status = "OP" if all(map(lambda t:t.status=="CM",deps)) else "LO" |
|
114 if subs and task.status in ["OP", "LO", "CM"]: |
|
115 task.status = "CM" if all(map(lambda t:t.status=="CM",subs)) else "LO" |
|
116 |
|
117 task.save() |
|
118 return task |