Fix errors causing data population to fail (#31)

* Modify card price reader to handle null price dictionaries (e.g. 10E Anaba Bodyguard)

* Add support for undocumented `subtypes`, `supertypes`, and `types` fields on `tokens`.
This commit is contained in:
Jason Addington 2019-10-12 09:58:18 -07:00 committed by Zach H
parent 9b18d52a5d
commit 6fa3063e7b

View file

@ -223,9 +223,12 @@ def build_sql_schema(output_file: Dict) -> None:
"scryfallOracleId TEXT(36),",
"setCode TEXT REFERENCES sets(code) ON UPDATE CASCADE ON DELETE CASCADE,",
"side TEXT,",
"subtypes TEXT,",
"supertypes TEXT,",
"text TEXT,",
"toughness TEXT,",
"type TEXT,",
"types TEXT,",
"uuid TEXT(36) UNIQUE,",
"watermark TEXT",
");",
@ -494,10 +497,11 @@ def handle_price_rows(
"""
prices = []
for price_type in card_data["prices"]:
for date, price in card_data["prices"][price_type].items():
prices.append(
{"uuid": card_uuid, "type": price_type, "price": price, "date": date}
)
if(card_data["prices"][price_type] is not None):
for date, price in card_data["prices"][price_type].items():
prices.append(
{"uuid": card_uuid, "type": price_type, "price": price, "date": date}
)
return prices