taskapp/events/task.py
changeset 162 d378eff02f2e
parent 158 c43e0114e593
child 166 ac72d641046e
--- a/taskapp/events/task.py	Mon Mar 01 11:52:00 2010 +0530
+++ b/taskapp/events/task.py	Mon Mar 01 12:44:27 2010 +0530
@@ -149,15 +149,17 @@
 
     user.request_sent_to.filter(is_replied=False, is_valid=True, role="MT", task=task).update(is_valid=False)
     
-def assignTask(task, user, assigned_by):
+def assignTask(task, added_user, assigned_by):
     """ check for the status of task and assign it to the particular user """
     
     if task.status in ['OP', 'WR']:
-        task.assigned_users.add(user)
-        task.claimed_users.remove(user)
+        task.assigned_users.add(added_user)
+        task.claimed_users.remove(added_user)
         task.status = "WR"
     task.save()
 
+    create_notification("AU", added_user, assigned_by, task=task)
+
 
 def updateTask(task, title=None, desc=None, credits=None, tags_field=None):
     """ update the property accordingly.
@@ -195,6 +197,7 @@
     ## TODiscuss : when a user is kicked off, his pending requests for pynts is made invalid
     rem_user.request_receiving_user.filter(task=main_task,role="PY",is_valid=True,is_replied=False).update(is_valid=False)
 
+    create_notification("RU", rem_user, removed_by, task=main_task, remarks=reason)
     ## TODO : create notification to the victim
 
 def assignCredits(task, given_by, given_to, points):