mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[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.
This commit is contained in:
parent
eb23a8c083
commit
318e55337c
@ -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,
|
||||
})
|
||||
|
@ -36,11 +36,17 @@
|
||||
<t t-foreach="groups" t-as="group">
|
||||
<span>
|
||||
<t t-if="group == current_group">
|
||||
<span class="bg-primary" t-out="group.display_name"/>
|
||||
<span class="bg-primary">
|
||||
<t t-out="group.display_name"/>
|
||||
(<t t-out="outstanding_per_group[group]"/>)
|
||||
</span>
|
||||
<a t-att-href="link()" class="btn fa fa-times p-0"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<a t-att-href="link(group=group.id, partner=0)" t-out="group.display_name"/>
|
||||
<a t-att-href="link(group=group.id, partner=0)">
|
||||
<t t-out="group.display_name"/>
|
||||
(<t t-out="outstanding_per_group[group]"/>)
|
||||
</a>
|
||||
</t>
|
||||
</span>
|
||||
</t>
|
||||
@ -51,7 +57,8 @@
|
||||
<t t-set="created" t-value="outstanding_per_author[culprit]"/>
|
||||
<a t-att-href="link(partner=culprit.id)"
|
||||
t-attf-title="approved {{approved}}, created {{created}}"
|
||||
><t t-out="culprit.display_name"/>:
|
||||
t-att-class="'bg-primary' if culprit == env.user.partner_id else None"
|
||||
><t t-out="culprit.name"/>:
|
||||
<t t-if="approved" t-out="approved"/>
|
||||
<t t-if="approved and created"> + </t>
|
||||
<t t-if="created" t-out="created"/>
|
||||
|
Loading…
Reference in New Issue
Block a user