Skip to content

Commit

Permalink
Rename duration back to $session_duration
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Apr 16, 2024
1 parent bf96830 commit 44920b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions frontend/src/lib/taxonomy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ export const CORE_FILTER_DEFINITIONS_BY_GROUP = {
numerical_event_properties: {}, // Same as event properties, see assignment below
person_properties: {}, // Currently person properties are the same as event properties, see assignment below
session_properties: {
duration: {
$session_duration: {
label: 'Session duration',
description: (
<span>
Expand Down Expand Up @@ -1022,7 +1022,7 @@ export const CORE_FILTER_DEFINITIONS_BY_GROUP = {
examples: ['https://example.com/interesting-article?parameter=true'],
},
$exit_url: {
label: 'Entry URL',
label: 'Exit URL',
description: <span>The last URL visited in this session</span>,
examples: ['https://example.com/interesting-article?parameter=true'],
},
Expand Down Expand Up @@ -1086,14 +1086,14 @@ for (const [key, value] of Object.entries(CORE_FILTER_DEFINITIONS_BY_GROUP.event
'description' in value
? `${value.description} Data from the first event in this session.`
: 'Data from the first event in this session.',
examples: value.examples,
examples: 'examples' in value ? value.examples : undefined,
}
}
}

// We treat `$session_duration` as an event property in the context of series `math`, but it's fake in a sense
CORE_FILTER_DEFINITIONS_BY_GROUP.event_properties.$session_duration =
CORE_FILTER_DEFINITIONS_BY_GROUP.session_properties.duration
CORE_FILTER_DEFINITIONS_BY_GROUP.session_properties.$session_duration

export const PROPERTY_KEYS = Object.keys(CORE_FILTER_DEFINITIONS_BY_GROUP.event_properties)

Expand Down
4 changes: 2 additions & 2 deletions posthog/hogql/database/schema/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"$event_count_map": DatabaseField(name="$event_count_map"),
"$pageview_count": IntegerDatabaseField(name="$pageview_count"),
"$autocapture_count": IntegerDatabaseField(name="$autocapture_count"),
"duration": IntegerDatabaseField(name="duration"),
"$session_duration": IntegerDatabaseField(name="duration"),
"$channel_type": StringDatabaseField(name="$channel_type"),
}

Expand Down Expand Up @@ -149,7 +149,7 @@ def select_from_sessions_table(
),
"$pageview_count": ast.Call(name="sum", args=[ast.Field(chain=[table_name, "pageview_count"])]),
"$autocapture_count": ast.Call(name="sum", args=[ast.Field(chain=[table_name, "autocapture_count"])]),
"duration": ast.Call(
"$session_duration": ast.Call(
name="dateDiff",
args=[
ast.Constant(value="second"),
Expand Down

0 comments on commit 44920b5

Please sign in to comment.