From dd5368219fc1bde87282d458b92e40b59f97793d Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Fri, 15 Nov 2024 16:58:36 +0100 Subject: [PATCH] Dev (#2753) * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * fix(chalice): create role return list of projects --- ee/api/chalicelib/core/roles.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ee/api/chalicelib/core/roles.py b/ee/api/chalicelib/core/roles.py index f22262cd5..ca1bf9812 100644 --- a/ee/api/chalicelib/core/roles.py +++ b/ee/api/chalicelib/core/roles.py @@ -101,12 +101,15 @@ def create(tenant_id, user_id, data: schemas.RolePayloadSchema): cur.execute(query=query) row = cur.fetchone() row["created_at"] = TimeUTC.datetime_to_timestamp(row["created_at"]) + row["projects"] = [] if not data.all_projects: role_id = row["role_id"] query = cur.mogrify(f"""INSERT INTO roles_projects(role_id, project_id) - VALUES {",".join(f"(%(role_id)s,%(project_id_{i})s)" for i in range(len(data.projects)))};""", + VALUES {",".join(f"(%(role_id)s,%(project_id_{i})s)" for i in range(len(data.projects)))} + RETURNING project_id;""", {"role_id": role_id, **{f"project_id_{i}": p for i, p in enumerate(data.projects)}}) cur.execute(query=query) + row["projects"] = [r["project_id"] for r in cur.fetchall()] return helper.dict_to_camel_case(row)