[IMP] forwardport: classify FP as outstanding a week after creation

Rather than a week after *source merge*.

Fixes #801
This commit is contained in:
Xavier Morel 2025-01-23 15:51:20 +01:00
parent 942570e60a
commit 60b84490c6
3 changed files with 16 additions and 8 deletions

View File

@ -0,0 +1,6 @@
IMP: outstanding classification
Forward ports are now considered "outstanding" if *they* were created more than
~a week ago, previously they would be counted as outstanding if their source was
merged more than a week ago (so for difficult forward ports they'd all be
considered outstanding leading to unnecessary reminders).

View File

@ -45,7 +45,6 @@ class Dashboard(MergebotDashboard):
'link': link,
})
source_filter = [('merge_date', '<', datetime.datetime.now() - DEFAULT_DELTA)]
partner_filter = []
if partner or group:
if partner:
@ -56,15 +55,16 @@ class Dashboard(MergebotDashboard):
arg = group.id
if authors:
partner_filter.append([(f'author{suffix}', '=', arg)])
partner_filter.append([(f'source_id.author{suffix}', '=', arg)])
if reviewers:
partner_filter.append([(f'reviewed_by{suffix}', '=', arg)])
source_filter.extend(expression.OR(partner_filter))
partner_filter.append([(f'source_id.reviewed_by{suffix}', '=', arg)])
outstanding = PullRequests.search([
('source_id', '!=', False),
('blocked', '!=', False),
('state', 'in', ['opened', 'validated', 'approved', 'ready', 'error']),
('source_id', 'in', PullRequests._search(source_filter)),
('create_date', '<', datetime.datetime.now() - DEFAULT_DELTA),
*(partner_filter and expression.OR(partner_filter)),
])
outstanding_per_group = collections.Counter()

View File

@ -10,12 +10,14 @@
<xpath expr="//div[@id='alerts']" position="inside">
<t t-if="env['runbot_merge.pull_requests'].check_access_rights('read', False)">
<t t-set="outstanding" t-value="env['runbot_merge.pull_requests'].search_count([
('source_id', '!=', False),
('blocked', '!=', False),
('state', 'in', ['opened', 'validated', 'approved', 'ready', 'error']),
('source_id.merge_date', '&lt;', datetime.datetime.now() - relativedelta(days=7)),
('create_date', '&lt;', datetime.datetime.now() - relativedelta(days=7)),
])"/>
<div t-if="outstanding != 0" class="alert col-md-12 alert-warning mb-0">
<a href="/forwardport/outstanding">
<t t-esc="outstanding"/> outstanding forward-ports (>1 week)
<t t-out="outstanding"/> outstanding forward-ports (>1 week)
</a>
</div>
</t>