feat(admin): filter card report by specific prebuilt deck

Prebuilt Decks filter now lists each deck by name in addition to the
existing "In any deck" / "Not in any deck" options, allowing the report
to be narrowed to cards belonging to a single specific deck.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-04-28 15:17:41 -04:00
co-authored by Claude Happy
parent 3e251c3c1c
commit 8c3b72cefc
@@ -137,8 +137,12 @@
<label class="form-label form-label-sm mb-1">Prebuilt Decks</label>
<select @bind="_filterInDeck" @bind:after="Filter" class="form-select form-select-sm">
<option value="">All</option>
<option value="yes">In a deck</option>
<option value="yes">In any deck</option>
<option value="no">Not in any deck</option>
@foreach (var deck in _decks)
{
<option value="@deck.Id">@deck.Name</option>
}
</select>
</div>
</div>
@@ -316,6 +320,7 @@
private List<CardRow>? _rows;
private List<CardRow> _filtered = new();
private List<CardSet> _sets = new();
private List<(Guid Id, string Name)> _decks = new();
private string _search = string.Empty;
private string _filterType = string.Empty;
@@ -346,8 +351,11 @@
var prebuiltDecks = await BazaarDb.PrebuiltDecks
.Include(d => d.Cards)
.OrderBy(d => d.Name)
.ToListAsync();
_decks = prebuiltDecks.Select(d => (d.Id, d.Name)).ToList();
// Build card → [deck] lookup.
var cardToDecks = new Dictionary<Guid, List<(Guid, string)>>();
foreach (var deck in prebuiltDecks)
@@ -438,6 +446,10 @@
if (_filterInDeck == "yes" && row.InDecks.Count == 0) return false;
if (_filterInDeck == "no" && row.InDecks.Count > 0) return false;
if (_filterInDeck != "" && _filterInDeck != "yes" && _filterInDeck != "no"
&& Guid.TryParse(_filterInDeck, out var deckId)
&& !row.InDecks.Any(d => d.Id == deckId))
return false;
return true;
}).ToList();