From 318e55337cb128653ac445efcd9f1b0a598d1651 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 28 Jun 2024 08:18:34 +0200 Subject: [PATCH] [FIX] forwardport: count next to users should be the fwport Previously it would count the number of source PRs with outstanding forward ports, which is not the count from the home page so that was confusing. Also add counts next to the groups, so teams can be identified at a glance. And finally outline the current user in the list, so they can find themselves faster when they're not one of the top entries. --- forwardport/controllers.py | 12 +++++++++--- forwardport/data/views.xml | 13 ++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/forwardport/controllers.py b/forwardport/controllers.py index 620eab96..7d7515d1 100644 --- a/forwardport/controllers.py +++ b/forwardport/controllers.py @@ -66,18 +66,23 @@ class Dashboard(MergebotDashboard): ('state', 'in', ['opened', 'validated', 'approved', 'ready', 'error']), ('source_id', 'in', PullRequests._search(source_filter)), ]) + + outstanding_per_group = collections.Counter() outstanding_per_author = collections.Counter() outstanding_per_reviewer = collections.Counter() outstandings = [] for source in outstanding.mapped('source_id').sorted('merge_date'): + prs = source.forwardport_ids.filtered(lambda p: p.state not in ['merged', 'closed']) outstandings.append({ 'source': source, - 'prs': source.forwardport_ids.filtered(lambda p: p.state not in ['merged', 'closed']), + 'prs': prs, }) if authors: - outstanding_per_author[source.author] += 1 + outstanding_per_author[source.author] += len(prs) + outstanding_per_group[source.author.commercial_partner_id] += len(prs) if reviewers and source: - outstanding_per_reviewer[source.reviewed_by] += 1 + outstanding_per_reviewer[source.reviewed_by] += len(prs) + outstanding_per_group[source.reviewed_by.commercial_partner_id] += len(prs) culprits = Partners.browse(p.id for p, _ in (outstanding_per_reviewer + outstanding_per_author).most_common()) return request.render('forwardport.outstanding', { @@ -89,6 +94,7 @@ class Dashboard(MergebotDashboard): 'current_group': group, 'outstanding_per_author': outstanding_per_author, 'outstanding_per_reviewer': outstanding_per_reviewer, + 'outstanding_per_group': outstanding_per_group, 'outstanding': outstandings, 'link': link, }) diff --git a/forwardport/data/views.xml b/forwardport/data/views.xml index be8480d9..f9d7f378 100644 --- a/forwardport/data/views.xml +++ b/forwardport/data/views.xml @@ -36,11 +36,17 @@ - + + + () + - + + + () + @@ -51,7 +57,8 @@ : + t-att-class="'bg-primary' if culprit == env.user.partner_id else None" + >: +