# HG changeset patch # User nishanth # Date 1267427667 -19800 # Node ID d378eff02f2ec893983412d048ee9191c799100b # Parent 74ef330c9185a0c65c58e2b36b0b5f5e91c9c14a added au ru notifications. diff -r 74ef330c9185 -r d378eff02f2e taskapp/events/task.py --- 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): diff -r 74ef330c9185 -r d378eff02f2e taskapp/models.py --- a/taskapp/models.py Mon Mar 01 11:52:00 2010 +0530 +++ b/taskapp/models.py Mon Mar 01 12:44:27 2010 +0530 @@ -34,9 +34,13 @@ ("CM", "Task completed"), ("CD", "Task closed"), ("DL", "Task deleted"), - ("KD", "Kicked off"), ("NU", "New User"), ("NT", "New Mentor"), + ("ND", "New Developer"), + ("NG", "New Manager"), + ("NA", "New Admin"), + ("AU", "Assign user"), ## i mean assign the task + ("RU", "Remove user"), ## remove from working users list in task ) diff -r 74ef330c9185 -r d378eff02f2e taskapp/utilities/notification.py --- a/taskapp/utilities/notification.py Mon Mar 01 11:52:00 2010 +0530 +++ b/taskapp/utilities/notification.py Mon Mar 01 12:44:27 2010 +0530 @@ -69,12 +69,12 @@ notification.sub = "%s rejected request to act as a mentor"%new_mentor.username notification.message = "%s has rejected your request asking him to act as a mentor for %s.
"%(new_mentor_url, task_url) if remarks: + notification.remarks = remarks notification.message += "Remarks: %s
"%remarks elif role in ["DV", "MG", "AD"]: notification.sent_from = sent_from - accepting_user = sent_from user_url = '%s'%(accepting_user.id, accepting_user.username) ## i mean the user who has accepted it requested_by_url = '%s'%(requested_by.id, requested_by.username) @@ -89,6 +89,7 @@ notification.sub = "Rejected your request to act as %s"%role_rights notification.message = "%s has rejected your request asking him to act as %s %s.
"%(user_url, a_or_an, role_rights) if remarks: + notification.remarks = remarks notification.message += "Remarks: %s
"%remarks elif role == "NT": @@ -162,8 +163,50 @@ notification.message = "The task %s has been closed by %s.
"%(task_url, mentor_url) if remarks: + notification.remarks = remarks notification.message += "Remarks: %s"%remarks + elif role == "AU": + + notification.task = task + added_user = sent_to + mentor = sent_from + assigned_by_url = '%s'%(mentor.id, mentor.username) + task_url= '%s'%(task.id, task.title) + + notification.sub = "Your claim for the task %s accepted."%task.title[:20] + notification.message = "You have been selected to work on the task %s by %s.
"%(task_url, assigned_by_url) + notification.message += "You can now start working on the task and will be credited by the mentors for your work.
" + + notification.message += " Here is a list of mentors for the task and their email addresses.
" + + working_users = task.assigned_users.exclude(id=added_user.id) + if working_users: + notification.message += "List of other users working on the task.
" + notification.message += "
" + + elif role == "RU": + + notification.task = task + removed_user = sent_to + mentor = sent_from + removed_by_url = '%s'%(mentor.id, mentor.username) + task_url = '%s'%(task.id, task.title) + claim_url = '%s'%(task.id, "clicking here") + + notification.sub = "You have been removed from working users of %s"%task.title[:20] + notification.message = "%s has removed you from the working users list of %s.
"%(removed_by_url, task_url) + notification.message += "if you want to work on the task again, you can claim the task by %s.
"%claim_url + if remarks: + notification.remarks = remarks + notification.message += "Reason: %s"%(remarks) + notification.save() diff -r 74ef330c9185 -r d378eff02f2e taskapp/views/task.py --- a/taskapp/views/task.py Mon Mar 01 11:52:00 2010 +0530 +++ b/taskapp/views/task.py Mon Mar 01 12:44:27 2010 +0530 @@ -393,7 +393,7 @@ 'task':task, } - if task.status in ["OP", "WR"]: + if task.status in ["WR"]: if assigned_users: form = RemoveUserForm(choices) context['form'] = form diff -r 74ef330c9185 -r d378eff02f2e templates/task/claim.html --- a/templates/task/claim.html Mon Mar 01 11:52:00 2010 +0530 +++ b/templates/task/claim.html Mon Mar 01 12:44:27 2010 +0530 @@ -11,7 +11,9 @@ {% else %} {% if task_claimable %} There are no claims for this task yet.
- Be the first to claim the task.
+ {% if user_can_claim %} + Be the first to claim the task.
+ {% endif %} {% else %} The task cannot be claimed at this stage.
{% endif %}