Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #840 from akatsoulas/fix-mentor
Browse files Browse the repository at this point in the history
[bug 1064233] Fix mentor to action item.
  • Loading branch information
akatsoulas committed Oct 27, 2014
2 parents f87f19b + 771aa3d commit 7e188b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions remo/dashboard/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ def test_mentor_validation(self):
ok_(not items.exists())

mentor = UserFactory.create(groups=['Rep', 'Mentor'])
user = UserFactory.create(groups=['Rep'],
userprofile__mentor=mentor)
UserFactory.create(groups=['Rep'], userprofile__mentor=mentor)

BugFactory.create(pending_mentor_validation=True, assigned_to=user)
BugFactory.create(pending_mentor_validation=True, assigned_to=mentor)

items = ActionItem.objects.filter(content_type=model)
eq_(items.count(), 1)
Expand All @@ -105,7 +104,7 @@ def test_mentor_change_update_action_items(self):
user = UserFactory.create(groups=['Rep'],
userprofile__mentor=mentor)

BugFactory.create(pending_mentor_validation=True, assigned_to=user)
BugFactory.create(pending_mentor_validation=True, assigned_to=mentor)

new_mentor = UserFactory.create(groups=['Rep', 'Mentor'])
user.userprofile.mentor = new_mentor
Expand All @@ -121,11 +120,10 @@ def test_resolve_mentor_validation(self):
ok_(not items.exists())

mentor = UserFactory.create(groups=['Rep', 'Mentor'])
user = UserFactory.create(groups=['Rep'],
userprofile__mentor=mentor)
UserFactory.create(groups=['Rep'], userprofile__mentor=mentor)

bug = BugFactory.create(pending_mentor_validation=True,
assigned_to=user)
assigned_to=mentor)

items = ActionItem.objects.filter(content_type=model)
eq_(items.count(), 1)
Expand Down
6 changes: 3 additions & 3 deletions remo/remozilla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_action_items(self):

action_name = WAITING_MENTOR_VALIDATION_ACTION
if self.assigned_to and user_is_rep(self.assigned_to):
mentor = self.assigned_to.userprofile.mentor
mentor = self.assigned_to
if self.pending_mentor_validation:
action_item = Item(action_name, mentor,
ActionItem.BLOCKER, None)
Expand Down Expand Up @@ -131,8 +131,8 @@ def save(self, *args, **kwargs):
items.update(user=self.assigned_to)

try:
current_mentor = current_bug.assigned_to.userprofile.mentor
new_mentor = self.assigned_to.userprofile.mentor
current_mentor = current_bug.assigned_to
new_mentor = self.assigned_to
except AttributeError:
current_mentor = None
new_mentor = None
Expand Down

0 comments on commit 7e188b6

Please sign in to comment.