fix(import): tolerate numeric my_rotation_id; skip empty deck slots

A real /load/index dump emits my_rotation_id as a bare number (0) for
unset MyRotation slots, which 400'd against the string? DTO field
(AllowReadingFromString only covers string->number). FlexibleStringConverter
accepts either form. Also skip empty deck slots (no cards) on import — a
dump carries every slot, mostly empty placeholders the client manages
itself.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-29 21:03:10 -04:00
parent 06108e4b6f
commit f754ef1ad3
4 changed files with 91 additions and 1 deletions

View File

@@ -206,6 +206,12 @@ public class AdminController : SVSimController
foreach (var d in request.Decks)
{
// A /load/index dump carries every deck slot, most of them empty placeholders
// (no cards). Skip them: the client manages empty slots itself (it's why the old
// default-deck cloning was removed), and importing empty MyRotation slots would
// otherwise persist decks with a bogus rotation id.
if ((d.CardIdArray?.Count ?? 0) == 0) continue;
Format format;
try { format = FormatExtensions.FromApi(d.DeckFormat); }
catch (ArgumentOutOfRangeException) { continue; } // skip unsupported wire format