From 3c4032d9313831e07834c1611e40874e4019f010 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Wed, 15 Apr 2026 15:24:42 -0400 Subject: [PATCH] Wire up wait stats benefit display in web plan viewer The wait benefit percentages were calculated by BenefitScorer and rendered in HTML export but not shown in the Blazor web viewer. Adds the "up to N%" badge next to each wait type in the Wait Stats insight card. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/PlanViewer.Web/Pages/Index.razor | 10 +++++++++- src/PlanViewer.Web/wwwroot/css/app.css | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/PlanViewer.Web/Pages/Index.razor b/src/PlanViewer.Web/Pages/Index.razor index 669efb5..c010b08 100644 --- a/src/PlanViewer.Web/Pages/Index.razor +++ b/src/PlanViewer.Web/Pages/Index.razor @@ -280,15 +280,23 @@ else @if (ActiveStmt!.WaitStats.Count > 0) { var maxWait = ActiveStmt!.WaitStats.Max(w => w.WaitTimeMs); + var benefitLookup = ActiveStmt!.WaitBenefits.ToDictionary(wb => wb.WaitType, wb => wb.MaxBenefitPercent, StringComparer.OrdinalIgnoreCase); @foreach (var w in ActiveStmt!.WaitStats.OrderByDescending(w => w.WaitTimeMs)) { var barPct = maxWait > 0 ? (double)w.WaitTimeMs / maxWait * 100 : 0; + benefitLookup.TryGetValue(w.WaitType, out var benefitPct);
@w.WaitType
- @w.WaitTimeMs.ToString("N0") ms + + @w.WaitTimeMs.ToString("N0") ms + @if (benefitPct > 0) + { + up to @benefitPct.ToString("N0")% + } +
} } diff --git a/src/PlanViewer.Web/wwwroot/css/app.css b/src/PlanViewer.Web/wwwroot/css/app.css index b352858..f512855 100644 --- a/src/PlanViewer.Web/wwwroot/css/app.css +++ b/src/PlanViewer.Web/wwwroot/css/app.css @@ -717,6 +717,16 @@ textarea::placeholder { font-size: 0.7rem; } +.wait-benefit { + font-size: 0.65rem; + font-weight: 600; + color: var(--text-secondary); + padding: 0.05rem 0.3rem; + border-radius: 3px; + background: rgba(0, 0, 0, 0.04); + margin-left: 0.25rem; +} + /* === Warnings Strip === */ .warnings-strip { margin-bottom: 0.75rem;