Skip to content

Commit

Permalink
fix(chalice): fixed sessions search with not-contains operator for 1 …
Browse files Browse the repository at this point in the history
…single events filter
  • Loading branch information
tahayk committed Dec 8, 2023
1 parent a163a60 commit 3dd10ac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ee/api/chalicelib/core/sessions_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,6 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu
# limit THEN-events to 7 in CH because sequenceMatch cannot take more arguments
if event_index == 7 and data.events_order == schemas.SearchEventOrder._then:
break

if event_index < 2:
data.events_order = schemas.SearchEventOrder._or
if len(events_extra_join) > 0:
Expand Down Expand Up @@ -1395,7 +1394,11 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu

if has_values:
events_conditions = [c for c in list(set(sequence_conditions))]
events_conditions_where.append(f"({' OR '.join(events_conditions)})")
# events_conditions_where.append(f"({' OR '.join(events_conditions)})")
events_extra_join += f"""LEFT ANTI JOIN ( SELECT DISTINCT session_id
FROM {MAIN_EVENTS_TABLE} AS main
WHERE {' AND '.join(__events_where_basic)}
AND ({' OR '.join(events_conditions)})) AS sub USING(session_id)"""

events_query_part = f"""SELECT main.session_id,
MIN(main.datetime) AS first_event_ts,
Expand Down

0 comments on commit 3dd10ac

Please sign in to comment.