summaryrefslogtreecommitdiff
path: root/taskapp/events
diff options
context:
space:
mode:
authornishanth2010-02-27 17:20:22 +0530
committernishanth2010-02-27 17:20:22 +0530
commitfba7fd43e0da0fc60f934e459d700ef8b5caf0aa (patch)
tree899792ac3c52bfd4f440accee639596a2e73ce6c /taskapp/events
parent3ca4d43495c91fd1a9e19795a5f73d2ff224e759 (diff)
downloadpytask-fba7fd43e0da0fc60f934e459d700ef8b5caf0aa.tar.gz
pytask-fba7fd43e0da0fc60f934e459d700ef8b5caf0aa.tar.bz2
pytask-fba7fd43e0da0fc60f934e459d700ef8b5caf0aa.zip
added notifications for approval and rejection of a mentor.
Diffstat (limited to 'taskapp/events')
-rw-r--r--taskapp/events/request.py25
-rw-r--r--taskapp/events/task.py1
2 files changed, 17 insertions, 9 deletions
diff --git a/taskapp/events/request.py b/taskapp/events/request.py
index 22b8066..4469ef1 100644
--- a/taskapp/events/request.py
+++ b/taskapp/events/request.py
@@ -27,20 +27,27 @@ def reply_to_request(request_obj, reply, replied_by):
for a_mentor in task.mentors.all():
if reply:
addCredits(task, request_obj.sent_by, request_obj.receiving_user, pynts)
- create_notification(request_obj.role, a_mentor, replied_by, True, task, receiving_user, pynts, requested_by)
+ create_notification(request_obj.role, a_mentor, replied_by, True, task, request_obj.remarks, requested_by, receiving_user, pynts)
else:
- create_notification(request_obj.role, a_mentor, replied_by, False, task, receiving_user, pynts, requested_by, request_obj.remarks)
+ create_notification(request_obj.role, a_mentor, replied_by, False, task, request_obj.remarks, requested_by, receiving_user, pynts)
elif request_obj.role == "MT":
- ## add him as a mentor to the task
+ task = request_obj.task
+ requested_by = request_obj.sent_by
if reply:
- ## check for the current rights of request_obj.sent_by
- ## what if he is no more a mentor to the task
- addMentor(request_obj.task, request_obj.replied_by)
- ## pass on notification of request_obj.sent_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)
+
+ ## 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)
+ for a_user in task.assigned_users.all():
+ create_notification(request_obj.role, a_user, replied_by, True, task, request_obj.remarks, requested_by)
+
+ addMentor(task, request_obj.replied_by)
else:
- print "request for mentor rejected"
- ## pass on notification to request_obj.sent_by
+ ## tell the requested user that his request was rejected due to these reasons.
+ create_notification(request_obj.role, requested_by, replied_by, False, task, request_obj.remarks, requested_by)
elif request_obj.role in ["AD", "MG", "DV"]:
if reply:
diff --git a/taskapp/events/task.py b/taskapp/events/task.py
index d62216b..fb3c3f3 100644
--- a/taskapp/events/task.py
+++ b/taskapp/events/task.py
@@ -3,6 +3,7 @@ from pytask.taskapp.models import Profile, Task, Comment, Credit, Claim, Map
from pytask.taskapp.utilities.task import getTask
from pytask.taskapp.utilities.request import create_request
from pytask.taskapp.utilities.helper import get_key
+from pytask.taskapp.utilities.notification import create_notification
def publishTask(task, rem_mentors=True, rem_comments=True):
""" set the task status to open """