Skip to content

deduce missing set from reference - #77

Merged
toxicity1985 merged 1 commit into
mainfrom
fix/deduce-missing-sets-from-reference
Sep 28, 2026
Merged

toxicity1985 merged 1 commit into
mainfrom
fix/deduce-missing-sets-from-reference

Conversation

@julesduroux

Copy link
Copy Markdown
Contributor

Root cause
CardBuilder::applyPrintingIdentity() (src/Builder/CardBuilder.php:139) only links a card to a Set when the source payload has a cardSet.reference field. Some prints (e.g. ALT_EOLECB_A_AX_106_C, a Roots of Corruption Collector Booster promo pulled from the Altered API) come back with no cardSet from upstream, so card.set stays NULL. Since CardGroupSetFilter/set.reference filters use an inner JOIN card.set, any card with set = NULL is silently excluded — exactly what you're seeing.

Fix
The card's own reference already encodes the set (ALT_ — same convention already used for variation), and it matches Set.reference for every set in card_set.csv (e.g. EOLECB). I added a fallback in CardBuilder.php: when cardSet.reference is missing, derive it from the card reference's 2nd segment before looking it up.

This fixes it going forward for every import path (app:import:cards, app:import:equinox, and the live API scraper).

Backfill for already-imported cards
Fixing the builder doesn't retroactively repair cards already sitting in the DB with set_id = NULL. I added FixMissingCardSetCommand.php (app:fix:missing-card-set, with --dry-run) that finds those cards, derives the set from their reference the same way, and backfills set_id/set_date. I couldn't run it here — no PHP/DB available in this sandbox — so run it yourself once you're ready:

php bin/console app:fix:missing-card-set --dry-run
php bin/console app:fix:missing-card-set
Any leftover "unmapped" references it reports would be genuine oddballs (reference doesn't match any known Set.reference) worth a manual look.

@toxicity1985
toxicity1985 merged commit fac5f11 into main Sep 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants