From c8ad140298af6b5c2792af78198d72ba3b31fe46 Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Thu, 25 Jul 2024 11:51:31 +0200 Subject: [PATCH] Patch/api v1.19.0 (#2428) * fix(chalice): changed mobile autocomplete * fix(chalice): fixed mobile errors search fix(chalice): fixed mobile errors autocomplete fix(chalice): fixed mobile swipe autocomplete (cherry picked from commit 64a746873bf6cf8f7f4e889f652ffd3bcc7d3385) --- api/chalicelib/core/autocomplete.py | 12 ++++++------ api/chalicelib/core/events.py | 27 +++++++++++++++------------ api/chalicelib/core/sessions.py | 2 +- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/api/chalicelib/core/autocomplete.py b/api/chalicelib/core/autocomplete.py index 61262d1bf..fc9a8f2e9 100644 --- a/api/chalicelib/core/autocomplete.py +++ b/api/chalicelib/core/autocomplete.py @@ -231,7 +231,7 @@ def __search_errors_mobile(project_id, value, key=None, source=None): query = f"""(SELECT DISTINCT ON(lg.reason) lg.reason AS value, '{events.EventType.CRASH_MOBILE.ui_type}' AS type - FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_id) LEFT JOIN public.sessions AS s USING(session_id) + FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_ios_id) LEFT JOIN public.sessions AS s USING(session_id) WHERE s.project_id = %(project_id)s AND lg.project_id = %(project_id)s @@ -241,7 +241,7 @@ def __search_errors_mobile(project_id, value, key=None, source=None): (SELECT DISTINCT ON(lg.name) lg.name AS value, '{events.EventType.CRASH_MOBILE.ui_type}' AS type - FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_id) LEFT JOIN public.sessions AS s USING(session_id) + FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_ios_id) LEFT JOIN public.sessions AS s USING(session_id) WHERE s.project_id = %(project_id)s AND lg.project_id = %(project_id)s @@ -251,7 +251,7 @@ def __search_errors_mobile(project_id, value, key=None, source=None): (SELECT DISTINCT ON(lg.reason) lg.reason AS value, '{events.EventType.CRASH_MOBILE.ui_type}' AS type - FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_id) LEFT JOIN public.sessions AS s USING(session_id) + FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_ios_id) LEFT JOIN public.sessions AS s USING(session_id) WHERE s.project_id = %(project_id)s AND lg.project_id = %(project_id)s @@ -261,7 +261,7 @@ def __search_errors_mobile(project_id, value, key=None, source=None): (SELECT DISTINCT ON(lg.name) lg.name AS value, '{events.EventType.CRASH_MOBILE.ui_type}' AS type - FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_id) LEFT JOIN public.sessions AS s USING(session_id) + FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_ios_id) LEFT JOIN public.sessions AS s USING(session_id) WHERE s.project_id = %(project_id)s AND lg.project_id = %(project_id)s @@ -271,7 +271,7 @@ def __search_errors_mobile(project_id, value, key=None, source=None): query = f"""(SELECT DISTINCT ON(lg.reason) lg.reason AS value, '{events.EventType.CRASH_MOBILE.ui_type}' AS type - FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_id) LEFT JOIN public.sessions AS s USING(session_id) + FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_ios_id) LEFT JOIN public.sessions AS s USING(session_id) WHERE s.project_id = %(project_id)s AND lg.project_id = %(project_id)s @@ -281,7 +281,7 @@ def __search_errors_mobile(project_id, value, key=None, source=None): (SELECT DISTINCT ON(lg.name) lg.name AS value, '{events.EventType.CRASH_MOBILE.ui_type}' AS type - FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_id) LEFT JOIN public.sessions AS s USING(session_id) + FROM {events.EventType.CRASH_MOBILE.table} INNER JOIN public.crashes_ios AS lg USING (crash_ios_id) LEFT JOIN public.sessions AS s USING(session_id) WHERE s.project_id = %(project_id)s AND lg.project_id = %(project_id)s diff --git a/api/chalicelib/core/events.py b/api/chalicelib/core/events.py index 412d03107..051b20d20 100644 --- a/api/chalicelib/core/events.py +++ b/api/chalicelib/core/events.py @@ -163,22 +163,25 @@ SUPPORTED_TYPES = { query=None), # MOBILE EventType.CLICK_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.CLICK_MOBILE), - query=autocomplete.__generic_query( - typename=EventType.CLICK_MOBILE.ui_type)), + query=autocomplete.__generic_query( + typename=EventType.CLICK_MOBILE.ui_type)), + EventType.SWIPE_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.SWIPE_MOBILE), + query=autocomplete.__generic_query( + typename=EventType.SWIPE_MOBILE.ui_type)), EventType.INPUT_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.INPUT_MOBILE), - query=autocomplete.__generic_query( - typename=EventType.INPUT_MOBILE.ui_type)), + query=autocomplete.__generic_query( + typename=EventType.INPUT_MOBILE.ui_type)), EventType.VIEW_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.VIEW_MOBILE), - query=autocomplete.__generic_query( - typename=EventType.VIEW_MOBILE.ui_type)), - EventType.CUSTOM_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.CUSTOM_MOBILE), - query=autocomplete.__generic_query( - typename=EventType.CUSTOM_MOBILE.ui_type)), - EventType.REQUEST_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.REQUEST_MOBILE), query=autocomplete.__generic_query( - typename=EventType.REQUEST_MOBILE.ui_type)), + typename=EventType.VIEW_MOBILE.ui_type)), + EventType.CUSTOM_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.CUSTOM_MOBILE), + query=autocomplete.__generic_query( + typename=EventType.CUSTOM_MOBILE.ui_type)), + EventType.REQUEST_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.REQUEST_MOBILE), + query=autocomplete.__generic_query( + typename=EventType.REQUEST_MOBILE.ui_type)), EventType.CRASH_MOBILE.ui_type: SupportedFilter(get=autocomplete.__search_errors_mobile, - query=None), + query=None), } diff --git a/api/chalicelib/core/sessions.py b/api/chalicelib/core/sessions.py index fd0f89de7..254d71364 100644 --- a/api/chalicelib/core/sessions.py +++ b/api/chalicelib/core/sessions.py @@ -886,7 +886,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status, sh.multi_conditions(f"main.{events.EventType.REQUEST_MOBILE.column} {op} %({e_k})s", event.value, value_key=e_k)) elif event_type == events.EventType.CRASH_MOBILE.ui_type: - event_from = event_from % f"{events.EventType.CRASH_MOBILE.table} AS main INNER JOIN public.crashes_ios AS main1 USING(crash_id)" + event_from = event_from % f"{events.EventType.CRASH_MOBILE.table} AS main INNER JOIN public.crashes_ios AS main1 USING(crash_ios_id)" if not is_any and event.value not in [None, "*", ""]: event_where.append( sh.multi_conditions(f"(main1.reason {op} %({e_k})s OR main1.name {op} %({e_k})s)",