From e19c6effc9fd28adece4f9bd005359037382d025 Mon Sep 17 00:00:00 2001
From: nishanth
Date: Thu, 4 Mar 2010 17:29:00 +0530
Subject: now a notification is sent to all the mentors after there is a new
claim.
---
taskapp/events/task.py | 3 +++
taskapp/utilities/notification.py | 15 +++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/taskapp/events/task.py b/taskapp/events/task.py
index 0a077ce..5fb896c 100644
--- a/taskapp/events/task.py
+++ b/taskapp/events/task.py
@@ -155,6 +155,9 @@ def addClaim(task, message, user):
user_url = '%s'%(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)
+
+ for a_mentor in task.mentors.all():
+ create_notification("CL", a_mentor, user, task=task, remarks=message)
def assignTask(task, added_user, assigned_by):
""" check for the status of task and assign it to the particular user """
diff --git a/taskapp/utilities/notification.py b/taskapp/utilities/notification.py
index 696f5b5..9887238 100644
--- a/taskapp/utilities/notification.py
+++ b/taskapp/utilities/notification.py
@@ -222,6 +222,21 @@ def create_notification(role, sent_to, sent_from=None, reply=None, task=None, re
notification.remarks = remarks
notification.message += "Reason: %s"%remarks
+ elif role == "CL":
+
+ notification.sent_from = sent_from
+ notification.task = task
+ notification.remarks = remarks
+
+ claimed_by_url = '%s'%(sent_from.id, sent_from.username)
+ task_url = '%s'%(task.id, task.title)
+
+ notification.sub = 'New claim for the task "%s"'%(task.title[:20])
+ notification.message = '%s has submitted a claim for the task "%s" mentored by you.
'%(claimed_by_url, task_url)
+ notification.message += 'Claim proposal: %s'%(remarks)
+
+
+
notification.save()
def mark_notification_read(notification_id):
--
cgit