diff options
author | nishanth | 2010-02-28 14:44:10 +0530 |
---|---|---|
committer | nishanth | 2010-02-28 14:44:10 +0530 |
commit | 4c7b03f6ca38e30b5394456ea9792e5cd6b4bfde (patch) | |
tree | c328c9b37f356c08c6a472923f78c8a3b88802ec /taskapp/events | |
parent | 33857f7042c0e72b29a8963b2ee3fe3c9696197b (diff) | |
download | pytask-4c7b03f6ca38e30b5394456ea9792e5cd6b4bfde.tar.gz pytask-4c7b03f6ca38e30b5394456ea9792e5cd6b4bfde.tar.bz2 pytask-4c7b03f6ca38e30b5394456ea9792e5cd6b4bfde.zip |
now if a user accepts to be a mentor, all his pending reqs will be made invalid.
Diffstat (limited to 'taskapp/events')
-rw-r--r-- | taskapp/events/request.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/taskapp/events/request.py b/taskapp/events/request.py index 508bc7b..2ad066b 100644 --- a/taskapp/events/request.py +++ b/taskapp/events/request.py @@ -39,6 +39,14 @@ def reply_to_request(request_obj, reply, replied_by): ## tell the replied user that he is mentor for this task and give him learn more link create_notification("NT", request_obj.replied_by, task=task) + ## now check if there are such similar requests and mark them as invalid + ## they cannot be of type PY and so we can use the replied_by to get requests + pending_requests = replied_by.request_sent_to.filter(is_valid=True, is_replied=False, role="MT",task=task) + for req in pending_requests: + create_notification("MT", req.sent_by, replied_by, False, task=req.task, remarks = "User has already accepted one such request and is a mentor.", requested_by = req.sent_by) + req.is_valid = False + req.save() + ## alert all the mentors including who made request and all assigned users for a_mentor in task.mentors.all(): create_notification(request_obj.role, a_mentor, replied_by, True, task, request_obj.remarks, requested_by) |