Group strategies by base type and rank them by median hold time
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d2cbab5d4b
commit
cbd9830143
12 files changed
+301
-35
No files matched your search
@@ -1,25 +1,40 @@
|
||||
@using System.Globalization
|
||||
@using Flypaper.Storage.Dashboard
|
||||
@using Flypaper.Web.Components.Shared
|
||||
|
||||
@{
|
||||
var byMedian = Entries.Any(entry => entry.MedianHold is not null);
|
||||
var barMax = byMedian
|
||||
? Entries.Where(entry => entry.Count >= StrategyNames.MinCatches).Select(entry => entry.MedianHold!.Value.TotalMilliseconds).DefaultIfEmpty(0).Max()
|
||||
: Entries.Count == 0 ? 0 : Entries[0].Count;
|
||||
}
|
||||
@if (Entries.Count == 0)
|
||||
{
|
||||
<p class="empty">Noch keine Einträge.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="top-table">
|
||||
<table class="top-table @(byMedian ? "by-median" : null)">
|
||||
<colgroup>
|
||||
<col />
|
||||
<col class="share" />
|
||||
<col class="count" />
|
||||
<col class="hold" />
|
||||
@if (byMedian)
|
||||
{
|
||||
<col class="hold" />
|
||||
}
|
||||
<col class="hold sum" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@KeyLabel</th>
|
||||
<th><span class="sr-only">Anteil</span></th>
|
||||
<th class="num">Fänge</th>
|
||||
<th class="num">Haltezeit</th>
|
||||
@if (byMedian)
|
||||
{
|
||||
<th class="num" title="Mittlere Haltezeit pro Fang (Median): Einzelne Dauerhalter verfälschen sie nicht">Median</th>
|
||||
}
|
||||
<th class="num sum">@(byMedian ? "Summe" : "Haltezeit")</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -27,10 +42,18 @@ else
|
||||
{
|
||||
var key = KeyFormatter?.Invoke(entry.Key) ?? entry.Key;
|
||||
var label = LabelFormatter is null ? entry.Label : LabelFormatter(entry.Key, entry.Label);
|
||||
var share = (entry.Count * 100.0 / Entries[0].Count).ToString("0.#", CultureInfo.InvariantCulture);
|
||||
var value = byMedian ? entry.MedianHold!.Value.TotalMilliseconds : entry.Count;
|
||||
var share = (barMax == 0 ? 0 : Math.Min(100, value * 100.0 / barMax)).ToString("0.#", CultureInfo.InvariantCulture);
|
||||
var sparse = byMedian && entry.Count < StrategyNames.MinCatches;
|
||||
var badges = BadgesFormatter?.Invoke(entry.Key) ?? [];
|
||||
var active = IsActive(entry);
|
||||
var title = TitleFormatter?.Invoke(entry.Key) ?? (label is null ? key : $"{label} · {key}");
|
||||
<tr data-href="@Href(entry)" class="@(active ? "active" : null)">
|
||||
if (sparse)
|
||||
{
|
||||
title += $"\nNur {entry.Count} {(entry.Count == 1 ? "Fang" : "Fänge")}: wenig aussagekräftig";
|
||||
}
|
||||
|
||||
<tr data-href="@Href(entry)" class="@(active ? "active" : null) @(sparse ? "sparse" : null)">
|
||||
<td class="clip" title="@title">
|
||||
<a href="@Href(entry)" aria-current="@(active ? "true" : null)" title="@(active ? $"Filter {title} entfernen" : $"Fänge filtern: {title}")">
|
||||
@if (ShowFlags)
|
||||
@@ -40,6 +63,14 @@ else
|
||||
@if (label is not null)
|
||||
{
|
||||
<span class="top-label">@label</span>
|
||||
@foreach (var badge in badges)
|
||||
{
|
||||
<span class="badge">@badge</span>
|
||||
}
|
||||
@if (sparse)
|
||||
{
|
||||
<span class="badge sparse-note">wenige Daten</span>
|
||||
}
|
||||
@if (key.Length > 0)
|
||||
{
|
||||
<span class="top-key mono">@key</span>
|
||||
@@ -53,11 +84,19 @@ else
|
||||
</td>
|
||||
<td><span class="share-bar" style="--share: @(share)%"></span></td>
|
||||
<td class="num">@Formatting.Number(entry.Count)</td>
|
||||
<td class="num">@Formatting.Duration(entry.HoldTime)</td>
|
||||
@if (byMedian)
|
||||
{
|
||||
<td class="num">@Formatting.Duration(entry.MedianHold!.Value)</td>
|
||||
}
|
||||
<td class="num sum">@Formatting.Duration(entry.HoldTime)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (byMedian)
|
||||
{
|
||||
<p class="top-note">Balken = Median Haltezeit pro Fang. Unter @StrategyNames.MinCatches Fängen wenig aussagekräftig, diese Zeilen stehen am Ende.</p>
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
@@ -73,6 +112,8 @@ else
|
||||
|
||||
[Parameter] public Func<string?, string?>? TitleFormatter { get; set; }
|
||||
|
||||
[Parameter] public Func<string?, IReadOnlyList<string>>? BadgesFormatter { get; set; }
|
||||
|
||||
[Parameter, EditorRequired] public required Func<TopEntry, string> Href { get; set; }
|
||||
|
||||
[Parameter, EditorRequired] public required Func<TopEntry, bool> IsActive { get; set; }
|
||||
|
||||
Reference in new issue
Block a user