taskapp/events/task.py
changeset 195 2717c8533322
parent 189 8f5fb15ffd9b
child 199 946d0fe60606
equal deleted inserted replaced
194:e43ceb9c4ec3 195:2717c8533322
   146     claim.task = task
   146     claim.task = task
   147     claim.user = user
   147     claim.user = user
   148     claim.creation_datetime = datetime.now()
   148     claim.creation_datetime = datetime.now()
   149     claim.save()
   149     claim.save()
   150 
   150 
   151     user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).update(is_valid=False)
   151     pending_reqs = user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).all()
       
   152     for req in pending_reqs:
       
   153         req.is_valid = False
       
   154         req.save()
       
   155         user_url = '<a href="/user/view/uid=%s">%s</a>'%(user.id, user.username)
       
   156         reason = "User has claimed the task and hence cannot be a mentor and this request was made invalid."
       
   157         create_notification("MT", req.sent_by, user, task=task, reply=False, remarks=reason, requested_by=req.sent_by)
   152     
   158     
   153 def assignTask(task, added_user, assigned_by):
   159 def assignTask(task, added_user, assigned_by):
   154     """ check for the status of task and assign it to the particular user """
   160     """ check for the status of task and assign it to the particular user """
   155     
   161     
   156     if task.status in ['OP', 'WR']:
   162     if task.status in ['OP', 'WR']: