diff --git a/api/chalicelib/core/autocomplete.py b/api/chalicelib/core/autocomplete.py index fec9c4d4d..84913f643 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 7299a1713..270acc133 100644 --- a/api/chalicelib/core/events.py +++ b/api/chalicelib/core/events.py @@ -134,7 +134,7 @@ class EventType: CUSTOM_MOBILE = Event(ui_type=schemas.EventType.custom_mobile, table="events_common.customs", column="name") REQUEST_MOBILE = Event(ui_type=schemas.EventType.request_mobile, table="events_common.requests", column="path") CRASH_MOBILE = Event(ui_type=schemas.EventType.error_mobile, table="events_common.crashes", - column=None) # column=None because errors are searched by name or message + column=None) # column=None because errors are searched by name or message SUPPORTED_TYPES = { @@ -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 b9a64cdc5..4a2d56d17 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)",