mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-24 00:47:50 +01:00
Fix
This commit is contained in:
parent
fbb5af5589
commit
8d3a2ae045
@ -2558,14 +2558,14 @@ export interface CustomChannelCondition {
|
||||
key: CustomChannelField
|
||||
value?: string | string[]
|
||||
op: CustomChannelOperator
|
||||
id: string
|
||||
id: string // the ID is only needed for the drag and drop, so only needs to be unique with one set of rules
|
||||
}
|
||||
|
||||
export interface CustomChannelRule {
|
||||
items: CustomChannelCondition[]
|
||||
combiner: FilterLogicalOperator
|
||||
channel_type: string
|
||||
id: string
|
||||
id: string // the ID is only needed for the drag and drop, so only needs to be unique with one set of rules
|
||||
}
|
||||
|
||||
export enum DefaultChannelTypes {
|
||||
|
@ -410,9 +410,7 @@ def get_lazy_session_table_values_v1(key: str, search_term: Optional[str], team:
|
||||
# the sessions table does not have a properties json object like the events and person tables
|
||||
|
||||
if key == "$channel_type":
|
||||
return [
|
||||
[entry] for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.value.lower()
|
||||
]
|
||||
return [[entry] for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.lower()]
|
||||
|
||||
field_definition = LAZY_SESSIONS_FIELDS.get(key)
|
||||
if not field_definition:
|
||||
|
@ -503,7 +503,7 @@ def get_lazy_session_table_values_v2(key: str, search_term: Optional[str], team:
|
||||
else:
|
||||
custom_channel_types = []
|
||||
default_channel_types = [
|
||||
entry for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.value.lower()
|
||||
entry for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.lower()
|
||||
]
|
||||
# merge the list, keep the order, and remove duplicates
|
||||
return [[name] for name in list(dict.fromkeys(custom_channel_types + default_channel_types))]
|
||||
|
@ -339,9 +339,10 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest):
|
||||
},
|
||||
custom_channel_rules=[
|
||||
CustomChannelRule(
|
||||
conditions=[CustomChannelCondition(key="utm_source", op="exact", value="test")],
|
||||
items=[CustomChannelCondition(key="utm_source", op="exact", value="test", id="1")],
|
||||
channel_type="Test",
|
||||
combiner=FilterLogicalOperator.AND_,
|
||||
id="a",
|
||||
)
|
||||
],
|
||||
)
|
||||
@ -355,9 +356,10 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest):
|
||||
},
|
||||
custom_channel_rules=[
|
||||
CustomChannelRule(
|
||||
conditions=[CustomChannelCondition(key="utm_source", op="exact", value=["test", "test2"])],
|
||||
items=[CustomChannelCondition(key="utm_source", op="exact", value=["test", "test2"], id="1")],
|
||||
channel_type="Test",
|
||||
combiner=FilterLogicalOperator.AND_,
|
||||
id="a",
|
||||
)
|
||||
],
|
||||
)
|
||||
@ -371,9 +373,10 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest):
|
||||
},
|
||||
custom_channel_rules=[
|
||||
CustomChannelRule(
|
||||
conditions=[CustomChannelCondition(key="utm_source", op="exact", value=["test"])],
|
||||
items=[CustomChannelCondition(key="utm_source", op="exact", value=["test"], id="1")],
|
||||
channel_type="Test",
|
||||
combiner=FilterLogicalOperator.AND_,
|
||||
id="a",
|
||||
)
|
||||
],
|
||||
)
|
||||
@ -388,12 +391,13 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest):
|
||||
},
|
||||
custom_channel_rules=[
|
||||
CustomChannelRule(
|
||||
conditions=[
|
||||
CustomChannelCondition(key="utm_source", op="exact", value="s"),
|
||||
CustomChannelCondition(key="utm_medium", op="exact", value="m"),
|
||||
items=[
|
||||
CustomChannelCondition(key="utm_source", op="exact", value="s", id="1"),
|
||||
CustomChannelCondition(key="utm_medium", op="exact", value="m", id="2"),
|
||||
],
|
||||
channel_type="Test",
|
||||
combiner=FilterLogicalOperator.AND_,
|
||||
id="a",
|
||||
)
|
||||
],
|
||||
)
|
||||
@ -407,14 +411,16 @@ class TestChannelType(ClickhouseTestMixin, APIBaseTest):
|
||||
},
|
||||
custom_channel_rules=[
|
||||
CustomChannelRule(
|
||||
conditions=[CustomChannelCondition(key="utm_source", op="exact", value="1")],
|
||||
items=[CustomChannelCondition(key="utm_source", op="exact", value="1", id="1")],
|
||||
channel_type="Test1",
|
||||
combiner=FilterLogicalOperator.AND_,
|
||||
id="a",
|
||||
),
|
||||
CustomChannelRule(
|
||||
conditions=[CustomChannelCondition(key="utm_source", op="exact", value="2")],
|
||||
items=[CustomChannelCondition(key="utm_source", op="exact", value="2", id="2")],
|
||||
channel_type="Test2",
|
||||
combiner=FilterLogicalOperator.AND_,
|
||||
id="b",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user