mtgjson / mtgjson-website

MTGJSON Documentation Front-End Application built with VitePress
https://mtgjson.com
MIT License
36 stars 24 forks source link

Tokens do not have expected edhrecRank field #549

Closed zqft9001 closed 2 years ago

zqft9001 commented 2 years ago

Version(s) tested against

5.2.0+20220426

Description of Bug

Tokens do not contain the expected edhrecRank field described in https://mtgjson.com/data-models/card-token/#edhrecrank

This appears to be from the lack of return for edhrecRank for the scryfall API for tokens, based on line 780 in set_builder.py used for both regular cards and tokens:

mtgjson_card.edhrec_rank = scryfall_object.get("edhrec_rank")

Compare card return (edhrec rank and link available): https://api.scryfall.com/cards/xln/96

vs token return (no ehdrec rank, edhrec link available but incorrect) https://api.scryfall.com/cards/tm20/1

Example token:

jq '.data.MID.tokens[1]' AllPrintings.json
{
  "artist": "Kim Sokol",
  "availability": [
    "paper"
  ],
  "borderColor": "borderless",
  "colorIdentity": [
    "W"
  ],
  "colors": [
    "W"
  ],
  "finishes": [
    "nonfoil",
    "foil"
  ],
  "frameVersion": "2015",
  "hasFoil": true,
  "hasNonFoil": true,
  "identifiers": {
    "mtgjsonV4Id": "0e11382b-3651-5a94-ba4d-c837920117bc",
    "scryfallId": "c865bc02-0562-408c-b18e-0e66da906fc6",
    "scryfallIllustrationId": "47683c7d-3b6e-46ed-925a-2460854802bb",
    "scryfallOracleId": "dc4e2134-f0c2-49aa-9ea3-ebf83af1445c"
  },
  "isReprint": true,
  "keywords": [
    "Flying"
  ],
  "layout": "token",
  "name": "Spirit",
  "number": "2",
  "power": "1",
  "reverseRelated": [
    "Abzan Ascendancy",
    "Afterlife",
    "Alharu, Solemn Ritualist",
    "Avacyn's Collar",
    "Benevolent Offering",
    "Bishop of Wings",
    "Blessed Defiance",
    "Brine Comber // Brinebound Gift",
    "Clarion Spirit",
    "Confront the Assault",
    "Court of Grace",
    "Custodi Soulbinders",
    "Dauntless Cathar",
    "Doomed Traveler",
    "Drogskol Cavalry",
    "Elgaud Inquisitor",
    "Emissary of the Sleepless",
    "Ethereal Investigator",
    "Field of Souls",
    "Gallows at Willow Hill",
    "Geist-Honored Monk",
    "Hallowed Spiritkeeper",
    "Hanged Executioner",
    "Haunted Dead",
    "Haunted Library",
    "Heron-Blessed Geist",
    "Kaya, Geist Hunter",
    "Kaya the Inexorable",
    "Kirtar's Wrath",
    "Kykar, Wind's Fury",
    "Lingering Souls",
    "Luminous Angel",
    "Mausoleum Guard",
    "Midnight Haunting",
    "Millicent, Restless Revenant",
    "Moorland Haunt",
    "Nearheath Chaplain",
    "Not Forgotten",
    "Nurturing Presence",
    "Occult Epiphany",
    "Priest of the Blessed Graf",
    "Ranar the Ever-Watchful",
    "Requiem Angel",
    "Rousing of Souls",
    "Sanctifier of Souls",
    "Sandsteppe Outcast",
    "Slayer's Plate",
    "Spectral Procession",
    "Spectral Reserves",
    "Spirit Bonds",
    "Spirit Cairn",
    "Teysa, Orzhov Scion",
    "Thalia's Geistcaller",
    "Thalisse, Reverent Medium",
    "Triplicate Spirits",
    "Twilight Drover",
    "Valor of the Worthy",
    "Vessel of Ephemera",
    "Whispering Wizard",
    "Millicent, Restless Revenant"
  ],
  "setCode": "TMID",
  "subtypes": [
    "Spirit"
  ],
  "supertypes": [],
  "text": "Flying",
  "toughness": "1",
  "type": "Token Creature — Spirit",
  "types": [
    "Token",
    "Creature"
  ],
  "uuid": "0c360f56-026d-582b-9a9f-afe878c099df"
}
ZeldaZach commented 2 years ago

Seems to be an oversight in the documentation. Will move to the Doc repo. Thanks for the report!!