Remove development print statements and rename policy.
This should now be a finished implementation of https://trac.tools.ietf.org/tools/ietfdb/wiki/ReviewerQueuePolicy except for missing LeastRecentlyUsed. - Legacy-Id: 17047
This commit is contained in:
parent
c5ecfab29f
commit
e188da5214
ietf/review
|
@ -26,7 +26,7 @@ Terminology used here should match terminology used in that document.
|
|||
|
||||
|
||||
def get_reviewer_queue_policy(team):
|
||||
return RotateWithSkipReviewerQueuePolicy(team)
|
||||
return RotateAlphabeticallyReviewerQueuePolicy(team)
|
||||
|
||||
|
||||
class AbstractReviewerQueuePolicy:
|
||||
|
@ -291,10 +291,9 @@ class AssignmentOrderResolver:
|
|||
return reviewer_settings
|
||||
|
||||
|
||||
class RotateWithSkipReviewerQueuePolicy(AbstractReviewerQueuePolicy):
|
||||
class RotateAlphabeticallyReviewerQueuePolicy(AbstractReviewerQueuePolicy):
|
||||
|
||||
def update_policy_state_for_assignment(self, assignee_person, add_skip=False):
|
||||
print('====================')
|
||||
assert assignee_person is not None
|
||||
|
||||
rotation_list = self.default_reviewer_rotation_list(dont_skip_person_ids=[assignee_person.pk])
|
||||
|
@ -312,14 +311,9 @@ class RotateWithSkipReviewerQueuePolicy(AbstractReviewerQueuePolicy):
|
|||
return
|
||||
|
||||
rotation_list_without_skip = [r for r in rotation_list if not reviewer_settings_for(r).skip_next]
|
||||
print('input: {} assigned'.format(assignee_person))
|
||||
print('with skipped {}'.format([r for r in rotation_list]))
|
||||
print('without skip {}'.format([r for r in rotation_list_without_skip]))
|
||||
print('skip counts {}'.format([(r, reviewer_settings_for(r).skip_next) for r in rotation_list]))
|
||||
# In order means: assigned to the first person in the rotation list with skip_next=0
|
||||
# If the assignment is not in order, skip_next and NextReviewerInTeam are not modified.
|
||||
in_order_assignment = rotation_list_without_skip[0] == assignee_person
|
||||
print('in order: {}'.format(in_order_assignment))
|
||||
|
||||
# Loop through the list until finding the first person with skip_next=0,
|
||||
# who is not the current assignee. Anyone with skip_next>0 encountered before
|
||||
|
@ -329,13 +323,10 @@ class RotateWithSkipReviewerQueuePolicy(AbstractReviewerQueuePolicy):
|
|||
while True:
|
||||
current_idx_person = reviewer_at_index(current_idx)
|
||||
settings = reviewer_settings_for(current_idx_person)
|
||||
print('evaluating {} with skip_next {}, assignee {}'.format(current_idx_person, settings.skip_next, assignee_person))
|
||||
if settings.skip_next > 0:
|
||||
print('dropping skip_next')
|
||||
settings.skip_next -= 1
|
||||
settings.save()
|
||||
elif current_idx_person != assignee_person:
|
||||
print('nr appointed')
|
||||
nr = NextReviewerInTeam.objects.filter(team=self.team).first() or NextReviewerInTeam(
|
||||
team=self.team)
|
||||
nr.next_reviewer = current_idx_person
|
||||
|
@ -345,7 +336,6 @@ class RotateWithSkipReviewerQueuePolicy(AbstractReviewerQueuePolicy):
|
|||
current_idx += 1
|
||||
|
||||
if add_skip:
|
||||
print('raising skip count for assignee')
|
||||
settings = reviewer_settings_for(assignee_person)
|
||||
settings.skip_next += 1
|
||||
settings.save()
|
||||
|
|
|
@ -12,7 +12,7 @@ from ietf.utils.test_data import create_person
|
|||
from ietf.utils.test_utils import TestCase
|
||||
|
||||
|
||||
class RotateWithSkipReviewerPolicyTests(TestCase):
|
||||
class RotateAlphabeticallyReviewerQueuePolicyTest(TestCase):
|
||||
def test_default_reviewer_rotation_list(self):
|
||||
team = ReviewTeamFactory(acronym="rotationteam", name="Review Team", list_email="rotationteam@ietf.org", parent=Group.objects.get(acronym="farfut"))
|
||||
policy = get_reviewer_queue_policy(team)
|
||||
|
|
Loading…
Reference in a new issue