mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[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:
parent
edaf507863
commit
63a4916d00
@ -79,10 +79,12 @@ class Dashboard(MergebotDashboard):
|
|||||||
})
|
})
|
||||||
if authors:
|
if authors:
|
||||||
outstanding_per_author[source.author] += len(prs)
|
outstanding_per_author[source.author] += len(prs)
|
||||||
outstanding_per_group[source.author.commercial_partner_id] += len(prs)
|
if reviewers:
|
||||||
if reviewers and source:
|
|
||||||
outstanding_per_reviewer[source.reviewed_by] += len(prs)
|
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())
|
culprits = Partners.browse(p.id for p, _ in (outstanding_per_reviewer + outstanding_per_author).most_common())
|
||||||
return request.render('forwardport.outstanding', {
|
return request.render('forwardport.outstanding', {
|
||||||
|
Loading…
Reference in New Issue
Block a user