openreplay/api/chalicelib/core/unprocessed_sessions.py
Kraiem Taha Yassine b9fc397e72
Dev (#2485)
* 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): get top 10 values for autocomplete CH

* feat(chalice): autocomplete return top 10 with stats

* fix(chalice): fixed autocomplete top 10 meta-filters

* fix(chalice): fixed predefined metrics
refactor(chalice): refactored schemas
refactor(chalice): refactored routers
refactor(chalice): refactored unprocessed sessions
2024-08-13 11:37:58 +02:00

18 lines
734 B
Python

import logging
from chalicelib.core import sessions, assist
logger = logging.getLogger(__name__)
def check_exists(project_id, session_id, not_found_response) -> (int | None, dict | None):
if session_id is None or not session_id.isnumeric():
return session_id, not_found_response
else:
session_id = int(session_id)
if not sessions.session_exists(project_id=project_id, session_id=session_id):
logger.warning(f"{project_id}/{session_id} not found in DB.")
if not assist.session_exists(project_id=project_id, session_id=session_id):
logger.warning(f"{project_id}/{session_id} not found in Assist.")
return session_id, not_found_response
return session_id, None