diff --git a/api/chalicelib/core/custom_metrics.py b/api/chalicelib/core/custom_metrics.py index e5c0039c81..406dbd9b1a 100644 --- a/api/chalicelib/core/custom_metrics.py +++ b/api/chalicelib/core/custom_metrics.py @@ -403,7 +403,7 @@ def update_card(metric_id, user_id, project_id, data: schemas.CardSchema): elif data.metric_type == schemas.MetricType.heat_map: if data.session_id is not None: params["session_data"] = json.dumps({"sessionId": data.session_id}) - elif "data" in metric: + elif metric.get("data"): params["session_data"] = json.dumps({"sessionId": metric["data"]["sessionId"]}) with pg_client.PostgresClient() as cur: diff --git a/ee/api/chalicelib/core/custom_metrics.py b/ee/api/chalicelib/core/custom_metrics.py index ebcb7a0773..6b8e996196 100644 --- a/ee/api/chalicelib/core/custom_metrics.py +++ b/ee/api/chalicelib/core/custom_metrics.py @@ -435,7 +435,7 @@ def update_card(metric_id, user_id, project_id, data: schemas.CardSchema): elif data.metric_type == schemas.MetricType.heat_map: if data.session_id is not None: params["session_data"] = json.dumps({"sessionId": data.session_id}) - elif "data" in metric: + elif metric.get("data"): params["session_data"] = json.dumps({"sessionId": metric["data"]["sessionId"]}) with pg_client.PostgresClient() as cur: