feat(chalice): refactored search sessions

This commit is contained in:
Taha Yassine Kraiem 2022-08-03 15:17:50 +02:00
parent 199ab159e3
commit c7c55195a2
2 changed files with 5 additions and 5 deletions

View file

@ -462,7 +462,7 @@ def __get_basic_constraints_pg(platform=None, time_constraint=True, startTime_ar
return ch_sub_query
def search(data: schemas.SearchErrorsSchema, project_id, user_id, flows=False):
def search_pg(data: schemas.SearchErrorsSchema, project_id, user_id, flows=False):
empty_response = {'total': 0,
'errors': []
}
@ -488,7 +488,7 @@ def search(data: schemas.SearchErrorsSchema, project_id, user_id, flows=False):
if len(data.events) > 0 or len(data.filters) > 0:
print("-- searching for sessions before errors")
# if favorite_only=True search for sessions associated with favorite_error
statuses = sessions.search2_pg(data=data, project_id=project_id, user_id=user_id, errors_only=True,
statuses = sessions.search_sessions(data=data, project_id=project_id, user_id=user_id, errors_only=True,
error_status=data.status)
if len(statuses) == 0:
return empty_response
@ -634,7 +634,7 @@ def search(data: schemas.SearchErrorsSchema, project_id, user_id, flows=False):
# refactor this function after clickhouse structure changes (missing search by query)
def search_deprecated(data: schemas.SearchErrorsSchema, project_id, user_id, flows=False):
def search(data: schemas.SearchErrorsSchema, project_id, user_id, flows=False):
empty_response = {"data": {
'total': 0,
'errors': []
@ -657,7 +657,7 @@ def search_deprecated(data: schemas.SearchErrorsSchema, project_id, user_id, flo
if len(data.events) > 0 or len(data.filters) > 0 or data.status != schemas.ErrorStatus.all:
print("-- searching for sessions before errors")
# if favorite_only=True search for sessions associated with favorite_error
statuses = sessions.search2_pg(data=data, project_id=project_id, user_id=user_id, errors_only=True,
statuses = sessions.search_sessions(data=data, project_id=project_id, user_id=user_id, errors_only=True,
error_status=data.status)
if len(statuses) == 0:
return empty_response

View file

@ -225,7 +225,7 @@ def _isUndefined_operator(op: schemas.SearchEventOperator):
return op in [schemas.SearchEventOperator._is_undefined]
def search2_pg(data: schemas.SessionsSearchPayloadSchema, project_id, user_id, errors_only=False,
def search_sessions(data: schemas.SessionsSearchPayloadSchema, project_id, user_id, errors_only=False,
error_status=schemas.ErrorStatus.all, count_only=False, issue=None):
full_args, query_part = search_query_parts(data=data, error_status=error_status, errors_only=errors_only,
favorite_only=data.bookmarked, issue=issue, project_id=project_id,