summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornishanth2010-03-04 14:50:24 +0530
committernishanth2010-03-04 14:50:24 +0530
commit7c80a05cedd837ebb279091b4d9bb426c274957f (patch)
treef6c98e5fd9397e0c85258decbccb06e631ecd63e
parent5f507d6835bc90804967c91e08f0a97d9c455ab7 (diff)
downloadpytask-7c80a05cedd837ebb279091b4d9bb426c274957f.tar.gz
pytask-7c80a05cedd837ebb279091b4d9bb426c274957f.tar.bz2
pytask-7c80a05cedd837ebb279091b4d9bb426c274957f.zip
if a user claims a task his unreplied mentor requests will be made invalid.
-rw-r--r--taskapp/events/task.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/taskapp/events/task.py b/taskapp/events/task.py
index 19e84b2..0a077ce 100644
--- a/taskapp/events/task.py
+++ b/taskapp/events/task.py
@@ -148,7 +148,13 @@ def addClaim(task, message, user):
claim.creation_datetime = datetime.now()
claim.save()
- user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).update(is_valid=False)
+ pending_reqs = user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).all()
+ for req in pending_reqs:
+ req.is_valid = False
+ req.save()
+ user_url = '<a href="/user/view/uid=%s">%s</a>'%(user.id, user.username)
+ reason = "User has claimed the task and hence cannot be a mentor and this request was made invalid."
+ create_notification("MT", req.sent_by, user, task=task, reply=False, remarks=reason, requested_by=req.sent_by)
def assignTask(task, added_user, assigned_by):
""" check for the status of task and assign it to the particular user """