[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
This commit is contained in:
Xavier Morel 2025-01-24 15:20:19 +01:00
parent edaf507863
commit 63a4916d00

View File

@ -79,10 +79,12 @@ class Dashboard(MergebotDashboard):
})
if authors:
outstanding_per_author[source.author] += len(prs)
outstanding_per_group[source.author.commercial_partner_id] += len(prs)
if reviewers and source:
if reviewers:
outstanding_per_reviewer[source.reviewed_by] += len(prs)
outstanding_per_group[source.reviewed_by.commercial_partner_id] += len(prs)
# if both the source and reviewer have the same team, don't count the PRs twice
for team in source.author.commercial_partner_id | source.reviewed_by.commercial_partner_id:
outstanding_per_group[team] += len(prs)
culprits = Partners.browse(p.id for p, _ in (outstanding_per_reviewer + outstanding_per_author).most_common())
return request.render('forwardport.outstanding', {