Skip to content

Commit

Permalink
fix(migration): Ensure cascadeParentIds key exists
Browse files Browse the repository at this point in the history
  • Loading branch information
john-bodley committed Jul 28, 2023
1 parent 5bb8e0d commit e6747b9
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ def upgrade():
filter_ids = {fltr["id"] for fltr in filters}

for fltr in filters:
for parent_id in fltr["cascadeParentIds"][:]:
for parent_id in fltr.get("cascadeParentIds", [])[:]:
if parent_id not in filter_ids:
fltr["cascadeParentIds"].remove(parent_id)
updated = True

if updated:
dashboard.json_metadata = json.dumps(json_metadata)

except Exception:
logging.exception(
f"Unable to parse JSON metadata for dashboard {dashboard.id}"
Expand Down

0 comments on commit e6747b9

Please sign in to comment.