mirror of
https://github.com/correl/mtgsqlive.git
synced 2024-11-25 11:09:51 +00:00
Fix for new prices structure (#47)
This commit is contained in:
parent
2deb975e89
commit
6988b47ca4
1 changed files with 17 additions and 18 deletions
|
@ -669,11 +669,10 @@ def parse_and_import_extras(input_file: pathlib.Path, output_file: Dict) -> None
|
||||||
"r", encoding="utf8"
|
"r", encoding="utf8"
|
||||||
) as f:
|
) as f:
|
||||||
json_data = json.load(f)
|
json_data = json.load(f)
|
||||||
for card_uuid in json_data:
|
for card_uuid, price_data in json_data.items():
|
||||||
for price_type in json_data[card_uuid]["prices"]:
|
for price_type, price_dict in price_data["prices"].items():
|
||||||
for price_date, price_value in json_data[card_uuid]["prices"][
|
if not price_type == "uuid":
|
||||||
price_type
|
for price_date, price_value in price_dict.items():
|
||||||
].items():
|
|
||||||
if price_value:
|
if price_value:
|
||||||
sql_dict_insert(
|
sql_dict_insert(
|
||||||
{
|
{
|
||||||
|
@ -988,7 +987,7 @@ def modify_for_sql_insert(data: Any) -> Union[str, int, float, None]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if isinstance(data, list) and data and isinstance(data[0], str):
|
if isinstance(data, list) and data and isinstance(data[0], str):
|
||||||
return ", ".join(data)
|
return ",".join(data)
|
||||||
|
|
||||||
if isinstance(data, bool):
|
if isinstance(data, bool):
|
||||||
return int(data)
|
return int(data)
|
||||||
|
@ -998,7 +997,7 @@ def modify_for_sql_insert(data: Any) -> Union[str, int, float, None]:
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def modify_for_sql_file(data: Any) -> Union[str, int, float, None]:
|
def modify_for_sql_file(data: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
for key in data.keys():
|
for key in data.keys():
|
||||||
if isinstance(data[key], str):
|
if isinstance(data[key], str):
|
||||||
data[key] = (
|
data[key] = (
|
||||||
|
|
Loading…
Reference in a new issue