fix(chalice): fixed enumeration based session's filters (including custom events) (#3055)

This commit is contained in:
Kraiem Taha Yassine 2025-02-21 17:31:56 +01:00 committed by GitHub
parent 74f6c2cd66
commit ed3020dc7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -381,7 +381,7 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu
filter_type = f.type
f.value = helper.values_for_operator(value=f.value, op=f.operator)
f_k = f"f_value{i}"
full_args = {**full_args, f_k: f.value, **sh.multi_values(f.value, value_key=f_k)}
full_args = {**full_args, f_k: sh.single_value(f.value), **sh.multi_values(f.value, value_key=f_k)}
op = sh.get_sql_operator(f.operator) \
if filter_type not in [schemas.FilterType.EVENTS_COUNT] else f.operator.value
is_any = sh.isAny_opreator(f.operator)

View file

@ -64,3 +64,12 @@ def isAny_opreator(op: schemas.SearchEventOperator):
def isUndefined_operator(op: schemas.SearchEventOperator):
return op in [schemas.SearchEventOperator.IS_UNDEFINED]
def single_value(values):
if values is not None and isinstance(values, list):
for i, v in enumerate(values):
if isinstance(v, Enum):
values[i] = v.value
return values