Skip to content

Commit 63a4916

Browse files
committed
[FIX] forwardport: avoid double counting PRs for teams
In the case where both author and reviewer of a PR have the same team (which is very common e.g. self review or a team member approving your PR) then the `outstanding_per_group` entry would be incremented twice, leading to overcounting outstanding forward ports for the team. Fixes #801
1 parent edaf507 commit 63a4916

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

forwardport/controllers.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ def outstanding(self, partner=0, authors=True, reviewers=True, group=0):
7979
})
8080
if authors:
8181
outstanding_per_author[source.author] += len(prs)
82-
outstanding_per_group[source.author.commercial_partner_id] += len(prs)
83-
if reviewers and source:
82+
if reviewers:
8483
outstanding_per_reviewer[source.reviewed_by] += len(prs)
85-
outstanding_per_group[source.reviewed_by.commercial_partner_id] += len(prs)
84+
85+
# if both the source and reviewer have the same team, don't count the PRs twice
86+
for team in source.author.commercial_partner_id | source.reviewed_by.commercial_partner_id:
87+
outstanding_per_group[team] += len(prs)
8688

8789
culprits = Partners.browse(p.id for p, _ in (outstanding_per_reviewer + outstanding_per_author).most_common())
8890
return request.render('forwardport.outstanding', {

0 commit comments

Comments
 (0)