taskapp/events/task.py
changeset 53 2c5062a93734
parent 25 c0e4fc8b8b5b
child 54 943d682aefdd
equal deleted inserted replaced
52:0b73f0d8e06e 53:2c5062a93734
     2 from pytask.taskapp.models import Profile, Task, Comment, Credit, Claim
     2 from pytask.taskapp.models import Profile, Task, Comment, Credit, Claim
     3 
     3 
     4 def publishTask(task):
     4 def publishTask(task):
     5     """ set the task status to open """
     5     """ set the task status to open """
     6     
     6     
     7     task.status = "OP"
     7     sub_tasks = task.subs.all()
       
     8     dependencies = task.deps.all()
       
     9     if sub_tasks or any(map(lambda t:t.status!="CM",dependencies)):
       
    10         task.status = "LO"
       
    11     else:
       
    12         task.status = "OP"
     8     task.save()
    13     task.save()
     9     return task
    14     return task
    10 
    15 
    11 def addMentor(task,mentor):
    16 def addMentor(task,mentor):
    12     """ add the mentor to mentors list of the task """
    17     """ add the mentor to mentors list of the task """