# HG changeset patch # User Nishanth Amuluru # Date 1294246330 -19800 # Node ID 59107ce0a6182783f744fd8ff90913ff33e7bf21 # Parent 307f699e6102fe5451d98ff337e975bf3f92e115 Replaced the word mentor with reviewer diff -r 307f699e6102 -r 59107ce0a618 taskapp/events/request.py --- a/taskapp/events/request.py Wed Jan 05 18:52:48 2011 +0530 +++ b/taskapp/events/request.py Wed Jan 05 22:22:10 2011 +0530 @@ -1,6 +1,6 @@ from datetime import datetime from pytask.taskapp.models import Profile -from pytask.taskapp.events.task import addMentor +from pytask.taskapp.events.task import addReviewer from pytask.taskapp.events.user import changeRole from pytask.taskapp.utilities.notification import create_notification @@ -33,24 +33,24 @@ task = request_obj.task requested_by = request_obj.sent_by if reply: - ## tell the replied user that he is mentor for this task and give him learn more link + ## tell the replied user that he is reviewer 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) + create_notification("MT", req.sent_by, replied_by, False, task=req.task, remarks = "User has already accepted one such request and is a reviewer.", 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) + ## alert all the reviewers including who made request and all assigned users + for a_reviewer in task.reviewers.all(): + create_notification(request_obj.role, a_reviewer, 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) + addReviewer(task, request_obj.replied_by) else: ## 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) diff -r 307f699e6102 -r 59107ce0a618 taskapp/events/task.py --- a/taskapp/events/task.py Wed Jan 05 18:52:48 2011 +0530 +++ b/taskapp/events/task.py Wed Jan 05 22:22:10 2011 +0530 @@ -5,7 +5,7 @@ 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): +def publishTask(task, rem_reviewers=True, rem_comments=True): """ set the task status to open """ # if task.sub_type == 'D': @@ -19,9 +19,9 @@ else: task.status = "OP" - if rem_mentors: - task.mentors.clear() - task.mentors.add(task.created_by) + if rem_reviewers: + task.reviewers.clear() + task.reviewers.add(task.created_by) if rem_comments: task.comment_set.update(is_deleted=True) @@ -93,22 +93,22 @@ main_task.save() -def reqMentor(task, mentor, req_by): +def reqReviewer(task, reviewer, req_by): """ create a request object with role as MT. """ - create_request(sent_by=req_by, role="MT", sent_to=mentor, task=task) + create_request(sent_by=req_by, role="MT", sent_to=reviewer, task=task) -def addMentor(task,mentor): - """ add the mentor to mentors list of the task """ +def addReviewer(task,reviewer): + """ add the reviewer to reviewers list of the task """ - task.mentors.add(mentor) + task.reviewers.add(reviewer) task.save() return task def createTask(title,desc,created_by,credits): """ creates a bare minimum task with title, description and credits. - the creator of the task will be assigned as a mentor for the task. + the creator of the task will be assigned as a reviewer for the task. """ while True: @@ -147,11 +147,11 @@ req.is_valid = False req.save() 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." + reason = "User has claimed the task and hence cannot be a reviewer 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) + for a_reviewer in task.reviewers.all(): + create_notification("CL", a_reviewer, 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 """ @@ -231,8 +231,8 @@ for a_user in task.claimed_users.all(): create_notification(role="CM", sent_to=a_user, sent_from=marked_by, task=task) - for a_mentor in task.mentors.all(): - create_notification(role="CM", sent_to=a_mentor, sent_from=marked_by, task=task) + for a_reviewer in task.reviewers.all(): + create_notification(role="CM", sent_to=a_reviewer, sent_from=marked_by, task=task) def closeTask(task, closed_by, reason=None): """ set the status of task as CD. @@ -253,8 +253,8 @@ for a_user in task.claimed_users.all(): create_notification(role="CD", sent_to=a_user, sent_from=closed_by, task=task, remarks=reason) - for a_mentor in task.mentors.all(): - create_notification(role="CD", sent_to=a_mentor, sent_from=closed_by, task=task, remarks=reason) + for a_reviewer in task.reviewers.all(): + create_notification(role="CD", sent_to=a_reviewer, sent_from=closed_by, task=task, remarks=reason) def deleteTask(task, deleted_by, reason=None): """ set the task status as DL @@ -267,5 +267,5 @@ pending_requests = task.request_task.filter(is_replied=False,is_valid=True) pending_requests.update(is_valid=False) - for a_mentor in task.mentors.exclude(id=deleted_by.id): - create_notification("DL", sent_to=a_mentor, sent_from=deleted_by, task=task, remarks=reason) + for a_reviewer in task.reviewers.exclude(id=deleted_by.id): + create_notification("DL", sent_to=a_reviewer, sent_from=deleted_by, task=task, remarks=reason) diff -r 307f699e6102 -r 59107ce0a618 taskapp/forms/task.py --- a/taskapp/forms/task.py Wed Jan 05 18:52:48 2011 +0530 +++ b/taskapp/forms/task.py Wed Jan 05 22:22:10 2011 +0530 @@ -45,11 +45,11 @@ except Task.DoesNotExist: return data -def AddMentorForm(choices,instance=None): +def AddReviewerForm(choices,instance=None): """ return a form object with appropriate choices """ class myform(forms.Form): - mentor = forms.ChoiceField(choices=choices, required=True) + reviewer = forms.ChoiceField(choices=choices, required=True) form = myform(instance) if instance else myform() return form diff -r 307f699e6102 -r 59107ce0a618 taskapp/management/commands/seed_db.py --- a/taskapp/management/commands/seed_db.py Wed Jan 05 18:52:48 2011 +0530 +++ b/taskapp/management/commands/seed_db.py Wed Jan 05 22:22:10 2011 +0530 @@ -14,9 +14,9 @@ def seed_db(): """ a method to seed the database with random data """ - defaultMentor = userEvents.createSuUser("admin", "admin@example.com", "123456", datetime.now(), "M") - mentor_profile = defaultMentor.get_profile() - userEvents.updateProfile(mentor_profile, {'rights':"AD"}) + defaultReviewer = userEvents.createSuUser("admin", "admin@example.com", "123456", datetime.now(), "M") + reviewer_profile = defaultReviewer.get_profile() + userEvents.updateProfile(reviewer_profile, {'rights':"AD"}) for i in range(1,21): @@ -29,11 +29,11 @@ create_notification("NU", user) if i%4==0: - create_request(defaultMentor, "MG", user) + create_request(defaultReviewer, "MG", user) elif i%3==0: - create_request(defaultMentor, "DV", user) + create_request(defaultReviewer, "DV", user) elif i%2==0: - create_request(defaultMentor, "AD", user) + create_request(defaultReviewer, "AD", user) elif i in [7, 13]: user.is_active = False user.save() @@ -42,12 +42,12 @@ title = "Task "+str(i) desc = "I am "+title - created_by = defaultMentor + created_by = defaultReviewer credits = 20 task = taskEvents.createTask(title,desc,created_by,credits) if task: - taskEvents.addMentor(task, defaultMentor) + taskEvents.addReviewer(task, defaultReviewer) if i%2==0:taskEvents.publishTask(task) class Command(NoArgsCommand): diff -r 307f699e6102 -r 59107ce0a618 taskapp/models.py --- a/taskapp/models.py Wed Jan 05 18:52:48 2011 +0530 +++ b/taskapp/models.py Wed Jan 05 22:22:10 2011 +0530 @@ -26,7 +26,7 @@ ("CM", "Completed")) NOTIFY_CHOICES = ( - ("MT", "Add Mentor"), + ("MT", "Add Reviewer"), ("DV", "Developer"), ("MG", "Manager"), ("AD", "Admin"), @@ -35,7 +35,7 @@ ("CD", "Task closed"), ("DL", "Task deleted"), ("NU", "New User"), - ("NT", "New Mentor"), + ("NT", "New Reviewer"), ("ND", "New Developer"), ("NG", "New Manager"), ("NA", "New Admin"), @@ -97,7 +97,7 @@ credits = models.PositiveSmallIntegerField(help_text = u"No.of credits a user gets on completing the task") progress = models.PositiveSmallIntegerField(default = 0) - mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors") + reviewers = models.ManyToManyField(User, related_name = "%(class)s_reviewers") created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users") assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users") diff -r 307f699e6102 -r 59107ce0a618 taskapp/utilities/notification.py --- a/taskapp/utilities/notification.py Wed Jan 05 18:52:48 2011 +0530 +++ b/taskapp/utilities/notification.py Wed Jan 05 22:22:10 2011 +0530 @@ -9,12 +9,12 @@ sent_to: a user to which the notification is to be sent sent_from : a user from which the message has originated A user who approves/rejects in case of request - A mentor who closes/complets the task + A reviewer who closes/complets the task reply: A boolean task: a task if applicable requested_by: a user makes the request - A mentor who assigns credits in case of pynts - A mentor who requests to act as a mentor + A reviewer who assigns credits in case of pynts + A reviewer who requests to act as a reviewer remarks: any remarks for rejecting receiving_user: user receiving pynts pynts: the obvious @@ -33,18 +33,18 @@ task_url= '%s'%(task.id, task.title) credits_url = '%s'%(task.id, "click here") - mentor_url = '%s'%(requested_by.id, requested_by.username) + reviewer_url = '%s'%(requested_by.id, requested_by.username) admin_url = '%s'%(sent_from.id, sent_from.username) user_url = '%s'%(receiving_user.id, receiving_user.username) if reply: notification.sub = "Approved request for assign of credits for %s"%task.title[:20] notification.message = """ Request made by %s to assign %s pynts to %s for the task %s has been approved by %s
- %s if you want the view/assign pynts page of the task.
"""%(mentor_url, pynts, user_url, task_url, admin_url, credits_url) + %s if you want the view/assign pynts page of the task.
"""%(reviewer_url, pynts, user_url, task_url, admin_url, credits_url) else: notification.sub = "Rejected request for assign of credits for %s"%task.title[:20] - notification.message = """ Request made by %s to assign %s pynts to %s for the task %s has been rejected by %s.
"""%(mentor_url, pynts, user_url, task_url, admin_url) + notification.message = """ Request made by %s to assign %s pynts to %s for the task %s has been rejected by %s.
"""%(reviewer_url, pynts, user_url, task_url, admin_url) if remarks: notification.remarks = remarks notification.message += "Reason: %s
"%remarks @@ -56,18 +56,18 @@ notification.sent_from = sent_from task_url= '%s'%(task.id, task.title) - requested_mentor_url = '%s'%(requested_by.id, requested_by.username) - new_mentor = sent_from - new_mentor_url = '%s'%(new_mentor.id, new_mentor.username) + requested_reviewer_url = '%s'%(requested_by.id, requested_by.username) + new_reviewer = sent_from + new_reviewer_url = '%s'%(new_reviewer.id, new_reviewer.username) if reply: - notification.sub = "New mentor for the task %s"%task.title[:20] - notification.message = "%s has accepted the request made by %s, asking him act as a mentor for the task %s
"%(new_mentor_url, requested_mentor_url, task_url) - notification.message += "He can be contacted on %s"%new_mentor.email + notification.sub = "New reviewer for the task %s"%task.title[:20] + notification.message = "%s has accepted the request made by %s, asking him act as a reviewer for the task %s
"%(new_reviewer_url, requested_reviewer_url, task_url) + notification.message += "He can be contacted on %s"%new_reviewer.email else: - 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) + notification.sub = "%s rejected request to act as a reviewer"%new_reviewer.username + notification.message = "%s has rejected your request asking him to act as a reviewer for %s.
"%(new_reviewer_url, task_url) if remarks: notification.remarks = remarks notification.message += "Remarks: %s
"%remarks @@ -95,16 +95,16 @@ elif role == "NT": notification.task = task - new_mentor = sent_to - mentor_learn_url = 'learn more' + new_reviewer = sent_to + reviewer_learn_url = 'learn more' task_url= '%s'%(task.id, task.title) - notification.sub = "You are mentoring the task %s"%task.title[:20] - notification.message = "You have accepted to act as a mentor%s for the task %s.
"%(mentor_learn_url, task_url) - notification.message += " Here is a list of other mentors and their email addresses.

" - notification.message += "Happy Mentoring." + notification.message += "Happy Reviewering." elif role == "NU": @@ -150,17 +150,17 @@ notification.task = task notification.remarks = remarks - mentor = sent_from - mentor_url = '%s'%(mentor.id, mentor.username) + reviewer = sent_from + reviewer_url = '%s'%(reviewer.id, reviewer.username) task_url= '%s'%(task.id, task.title) if role == "CM": notification.sub = "%s has been marked complete"%task.title - notification.message = "The task %s has been marked complete by %s.
"%(task_url, mentor_url) + notification.message = "The task %s has been marked complete by %s.
"%(task_url, reviewer_url) elif role == "CD": notification.sub = "%s has been closed"%task.title - notification.message = "The task %s has been closed by %s.
"%(task_url, mentor_url) + notification.message = "The task %s has been closed by %s.
"%(task_url, reviewer_url) if remarks: notification.remarks = remarks @@ -171,17 +171,17 @@ notification.task = task notification.sent_from = sent_from added_user = sent_to - mentor = sent_from - assigned_by_url = '%s'%(mentor.id, mentor.username) + reviewer = sent_from + assigned_by_url = '%s'%(reviewer.id, reviewer.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 += "You can now start working on the task and will be credited by the reviewers for your work.
" - notification.message += " Here is a list of mentors for the task and their email addresses.