fix(chalice): fixed Path Analysis support of contains/not-contains for exclude points (#1753)
(cherry picked from commit 98c49ecccb)
This commit is contained in:
parent
bee706e3e3
commit
00eeffe97a
2 changed files with 11 additions and 3 deletions
|
|
@ -126,11 +126,14 @@ def path_analysis(project_id: int, data: schemas.CardPathAnalysis):
|
|||
for i, ef in enumerate(data.excludes):
|
||||
if len(ef.value) == 0:
|
||||
continue
|
||||
ef.value = helper.values_for_operator(value=ef.value, op=ef.operator)
|
||||
op = sh.get_sql_operator(ef.operator)
|
||||
op = sh.reverse_sql_operator(op)
|
||||
if ef.type in data.metric_value:
|
||||
f_k = f"exclude_{i}"
|
||||
extra_values = {**extra_values, **sh.multi_values(ef.value, value_key=f_k)}
|
||||
exclusions[ef.type] = [
|
||||
sh.multi_conditions(f'{JOURNEY_TYPES[ef.type]["column"]} != %({f_k})s', ef.value, is_not=True,
|
||||
sh.multi_conditions(f'{JOURNEY_TYPES[ef.type]["column"]} {op} %({f_k})s', ef.value, is_not=True,
|
||||
value_key=f_k)]
|
||||
|
||||
meta_keys = None
|
||||
|
|
@ -407,7 +410,9 @@ WITH sub_sessions AS (SELECT session_id {sub_sessions_extra_projection}
|
|||
**extra_values}
|
||||
query = cur.mogrify(pg_query, params)
|
||||
_now = time()
|
||||
|
||||
logger.debug("----------------------")
|
||||
logger.debug(query)
|
||||
logger.debug("----------------------")
|
||||
cur.execute(query)
|
||||
if time() - _now > 2:
|
||||
logger.warning(f">>>>>>>>>PathAnalysis long query ({int(time() - _now)}s)<<<<<<<<<")
|
||||
|
|
|
|||
|
|
@ -139,9 +139,12 @@ def path_analysis(project_id: int, data: schemas.CardPathAnalysis):
|
|||
continue
|
||||
if ef.type in data.metric_value:
|
||||
f_k = f"exclude_{i}"
|
||||
ef.value = helper.values_for_operator(value=ef.value, op=ef.operator)
|
||||
op = sh.get_sql_operator(ef.operator)
|
||||
op = sh.reverse_sql_operator(op)
|
||||
extra_values = {**extra_values, **sh.multi_values(ef.value, value_key=f_k)}
|
||||
exclusions[ef.type] = [
|
||||
sh.multi_conditions(f'{JOURNEY_TYPES[ef.type]["column"]} != %({f_k})s', ef.value, is_not=True,
|
||||
sh.multi_conditions(f'{JOURNEY_TYPES[ef.type]["column"]} {op} %({f_k})s', ef.value, is_not=True,
|
||||
value_key=f_k)]
|
||||
|
||||
sessions_conditions = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue