mtgjson
mtgjson copied to clipboard
Misplaced SKU entries in TCGplayer SKUS
Version(s) tested against
MTGJSON Version: v5.2.0+20220530 SKUs File: https://mtgjson.com/api/v5/TcgplayerSkus.json.zip
Description of Bug
321 entries in the TcgplayerSkus file have SKU data for incorrect TCGplayer product IDs alongside their correct SKU data. The misplaced SKUs seem to be for related printings (i.e alt art, ext art), and exist under their correct UUID.
Examples:
- Infuriate, Strixhaven Mystical Archive (ae5d691c-6ddf-58b0-ada0-4a1c07fd904e)
- Persist, Modern Horizons 2 (6a9e6512-8aa9-5690-90f4-8f92d1d82c49)
- Scion of Halaster, Commander Legends: Battle for Baldur's Gate (8f82d67a-4fba-53e8-94a1-f7bdf350335f)
Workaround
If you have matched UUIDs to TCGplayer Product IDs, you can strip these misplaced SKUs from the dataset. In Ruby:
if sku_list.map { |sku| sku['productId'] }.uniq.count > 1
correct_product_id = Card.find_by(uuid: uuid).tcgplayer_product_id
sku_list = sku_list.select { |sku| sku['productId'] == correct_product_id }
end