From 2cfc8ff472078835c95416d7ce3423fda4585cc3 Mon Sep 17 00:00:00 2001 From: Jason Robbins Date: Thu, 9 Jan 2025 20:30:06 +0000 Subject: [PATCH] Don't calculate slo_resolve_remaining for old gates that were already resolved (#4677) * Don't calculate slo_resolve_remaining for old gates that were already resolved. * fixed-test --- api/converters.py | 2 +- api/converters_test.py | 2 +- client-src/elements/chromedash-gate-column.ts | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/api/converters.py b/api/converters.py index 8746d018ed90..dacfff289ee8 100644 --- a/api/converters.py +++ b/api/converters.py @@ -663,7 +663,7 @@ def gate_value_to_json_dict(gate: Gate) -> dict[str, Any]: if gate.resolved_on: slo_resolve_took = max(0, slo.weekdays_between( gate.requested_on, gate.resolved_on) - (gate.needs_work_elapsed or 0)) - else: + elif gate.state != Vote.NEEDS_WORK and gate.state not in Gate.FINAL_STATES: slo_resolve_remaining = slo.remaining_days( gate.requested_on, slo_resolve) + (gate.needs_work_elapsed or 0) diff --git a/api/converters_test.py b/api/converters_test.py index 6d9dd205c6f9..27a10fd57c66 100644 --- a/api/converters_test.py +++ b/api/converters_test.py @@ -583,7 +583,7 @@ def test_maxmimal(self, mock_now): 'slo_initial_response_remaining': -1, # One weekday overdue. 'slo_resolve': approval_defs.DEFAULT_SLO_RESOLVE_LIMIT, 'slo_resolve_took': None, - 'slo_resolve_remaining': 3, + 'slo_resolve_remaining': None, 'needs_work_started_on': None, } self.assertEqual(expected, actual) diff --git a/client-src/elements/chromedash-gate-column.ts b/client-src/elements/chromedash-gate-column.ts index f56436627355..a5146ea79d0a 100644 --- a/client-src/elements/chromedash-gate-column.ts +++ b/client-src/elements/chromedash-gate-column.ts @@ -621,7 +621,11 @@ export class ChromedashGateColumn extends LitElement { renderSLOStatusSkeleton() { return html`
- Reviewer SLO status: + SLO initial response: + Loading... +
+
+ SLO resolution: Loading...
`;