fix: chart import (#25425)

This commit is contained in:
Beto Dealmeida 2023-09-26 19:31:34 -07:00 committed by GitHub
parent 40ba3c2d57
commit a4d8f36863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -99,8 +99,8 @@ def migrate_chart(config: dict[str, Any]) -> dict[str, Any]:
# also update `query_context`
try:
query_context = json.loads(output.get("query_context", "{}"))
except json.decoder.JSONDecodeError:
query_context = json.loads(output.get("query_context") or "{}")
except (json.decoder.JSONDecodeError, TypeError):
query_context = {}
if "form_data" in query_context:
query_context["form_data"] = output["params"]

View File

@ -32,6 +32,7 @@ def test_migrate_chart_area() -> None:
"certified_by": None,
"certification_details": None,
"viz_type": "area",
"query_context": None,
"params": json.dumps(
{
"adhoc_filters": [],