Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove automatically suggested document for document that is already has review request (fixes #3211) #5425

Merged
merged 5 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ietf/group/tests_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,20 @@ def test_suggested_review_requests(self):

self.assertEqual(list(suggested_review_requests_for_team(team)), [])

# blocked by an already existing request (don't suggest it again)
review_req.state_id = "requested"
review_req.save()
self.assertEqual(list(suggested_review_requests_for_team(team)), [])

# ... but not for a previous version
review_req.requested_rev = prev_rev
review_req.save()
self.assertEqual(len(suggested_review_requests_for_team(team)), 1)


# blocked by completion
review_req.state = ReviewRequestStateName.objects.get(slug="assigned")
review_req.requested_rev = ""
review_req.save()
assignment.state = ReviewAssignmentStateName.objects.get(slug="completed")
assignment.reviewed_rev = review_req.doc.rev
Expand All @@ -116,6 +128,7 @@ def test_suggested_review_requests(self):

self.assertEqual(len(suggested_review_requests_for_team(team)), 1)


def test_suggested_review_requests_on_lc_and_telechat(self):
review_req = ReviewRequestFactory(state_id='assigned')
doc = review_req.doc
Expand Down
4 changes: 3 additions & 1 deletion ietf/review/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,12 @@ def blocks(existing, request):
and existing.reviewassignment_set.filter(state_id__in=("assigned", "accepted")).exists()
and (not existing.requested_rev or existing.requested_rev == request.doc.rev))
request_closed = existing.state_id not in ('requested','assigned')
# Is there a review request for this document already in system
requested = existing.state_id in ('requested') and (not existing.requested_rev or existing.requested_rev == request.doc.rev)
# at least one assignment was completed for the requested version or the current doc version if no specific version was requested:
some_assignment_completed = existing.reviewassignment_set.filter(reviewed_rev=existing.requested_rev or existing.doc.rev, state_id='completed').exists()

return any([no_review_document, no_review_rev, pending, request_closed, some_assignment_completed])
return any([no_review_document, no_review_rev, pending, request_closed, requested, some_assignment_completed])

res = [r for r in requests.values()
if not any(blocks(e, r) for e in existing_requests[r.doc_id])]
Expand Down