taskapp/events/task.py
changeset 162 d378eff02f2e
parent 158 c43e0114e593
child 166 ac72d641046e
equal deleted inserted replaced
161:74ef330c9185 162:d378eff02f2e
   147     claim.creation_datetime = datetime.now()
   147     claim.creation_datetime = datetime.now()
   148     claim.save()
   148     claim.save()
   149 
   149 
   150     user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).update(is_valid=False)
   150     user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).update(is_valid=False)
   151     
   151     
   152 def assignTask(task, user, assigned_by):
   152 def assignTask(task, added_user, assigned_by):
   153     """ check for the status of task and assign it to the particular user """
   153     """ check for the status of task and assign it to the particular user """
   154     
   154     
   155     if task.status in ['OP', 'WR']:
   155     if task.status in ['OP', 'WR']:
   156         task.assigned_users.add(user)
   156         task.assigned_users.add(added_user)
   157         task.claimed_users.remove(user)
   157         task.claimed_users.remove(added_user)
   158         task.status = "WR"
   158         task.status = "WR"
   159     task.save()
   159     task.save()
       
   160 
       
   161     create_notification("AU", added_user, assigned_by, task=task)
   160 
   162 
   161 
   163 
   162 def updateTask(task, title=None, desc=None, credits=None, tags_field=None):
   164 def updateTask(task, title=None, desc=None, credits=None, tags_field=None):
   163     """ update the property accordingly.
   165     """ update the property accordingly.
   164     while updating title, check for uniqueness of title.
   166     while updating title, check for uniqueness of title.
   193     main_task.save()
   195     main_task.save()
   194 
   196 
   195     ## TODiscuss : when a user is kicked off, his pending requests for pynts is made invalid
   197     ## TODiscuss : when a user is kicked off, his pending requests for pynts is made invalid
   196     rem_user.request_receiving_user.filter(task=main_task,role="PY",is_valid=True,is_replied=False).update(is_valid=False)
   198     rem_user.request_receiving_user.filter(task=main_task,role="PY",is_valid=True,is_replied=False).update(is_valid=False)
   197 
   199 
       
   200     create_notification("RU", rem_user, removed_by, task=main_task, remarks=reason)
   198     ## TODO : create notification to the victim
   201     ## TODO : create notification to the victim
   199 
   202 
   200 def assignCredits(task, given_by, given_to, points):
   203 def assignCredits(task, given_by, given_to, points):
   201     """ make a proper request object.
   204     """ make a proper request object.
   202     """
   205     """