From 92df1c671a697e2eee4a2a46330ba056b725543b Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Tue, 3 Sep 2024 17:33:16 +0200 Subject: [PATCH] Dev (#2532) * 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): fixed update scope for EE --- api/chalicelib/core/scope.py | 5 ++--- ee/api/chalicelib/core/scope.py | 5 ++--- ee/api/routers/core_dynamic.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/api/chalicelib/core/scope.py b/api/chalicelib/core/scope.py index 28424b334..9a7418129 100644 --- a/api/chalicelib/core/scope.py +++ b/api/chalicelib/core/scope.py @@ -1,6 +1,5 @@ from cachetools import cached, TTLCache -from chalicelib.utils import helper from chalicelib.utils import pg_client cache = TTLCache(maxsize=1, ttl=60) @@ -21,6 +20,6 @@ def update_scope(tenant_id, scope: int): SET scope_state = %(scope_state)s;""", {"scope_state": scope}) cur.execute(query) - if tenant_id in cache: - cache.pop(tenant_id) + if tenant_id in cache: + cache.pop(tenant_id) return scope diff --git a/ee/api/chalicelib/core/scope.py b/ee/api/chalicelib/core/scope.py index f8cb350d0..91e69410a 100644 --- a/ee/api/chalicelib/core/scope.py +++ b/ee/api/chalicelib/core/scope.py @@ -1,6 +1,5 @@ from cachetools import cached, TTLCache -from chalicelib.utils import helper from chalicelib.utils import pg_client cache = TTLCache(maxsize=1000, ttl=60) @@ -24,6 +23,6 @@ def update_scope(tenant_id, scope: int): WHERE tenant_id=%(tenant_id)s;""", {"scope_state": scope, "tenant_id": tenant_id}) cur.execute(query) - if tenant_id in cache: - cache.pop(tenant_id) + if tenant_id in cache: + cache.pop(tenant_id) return scope diff --git a/ee/api/routers/core_dynamic.py b/ee/api/routers/core_dynamic.py index b429e06aa..1272f4950 100644 --- a/ee/api/routers/core_dynamic.py +++ b/ee/api/routers/core_dynamic.py @@ -147,7 +147,7 @@ def edit_account(data: schemas.EditAccountSchema = Body(...), @app.post('/account/scope', tags=["account"]) def change_scope(data: schemas.ScopeSchema = Body(), context: schemas.CurrentContext = Depends(OR_context)): - data = scope.update_scope(tenant_id=-1, scope=data.scope) + data = scope.update_scope(tenant_id=context.tenant_id, scope=data.scope) return {'data': data}