Skip to content

Commit

Permalink
fix retention query runner
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Jan 17, 2024
1 parent 142c125 commit 0fec76d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions posthog/hogql_queries/insights/retention_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def get_applicable_entity(self, event_query_type):
"type": TREND_FILTER_TYPE_EVENTS,
}
)
target_entity = self.query.retentionFilter.target_entity or default_entity
target_entity = self.query.retentionFilter.targetEntity or default_entity
if event_query_type in [RetentionQueryType.TARGET, RetentionQueryType.TARGET_FIRST_TIME]:
return target_entity

return self.query.retentionFilter.returning_entity or target_entity
return self.query.retentionFilter.returningEntity or target_entity

def retention_events_query(self, event_query_type) -> ast.SelectQuery:
start_of_interval_sql = self.query_date_range.get_start_of_interval_hogql(
Expand Down Expand Up @@ -186,7 +186,7 @@ def date_filter_expr(self, event_query_type) -> ast.Expr:
def build_target_event_query(self) -> ast.SelectQuery:
event_query_type = (
RetentionQueryType.TARGET_FIRST_TIME
if self.query.retentionFilter.retention_type == RetentionType.retention_first_time
if self.query.retentionFilter.retentionType == RetentionType.retention_first_time
else RetentionQueryType.TARGET
)
return self.retention_events_query(event_query_type=event_query_type)
Expand Down Expand Up @@ -266,7 +266,7 @@ def to_query(self) -> ast.SelectQuery | ast.SelectUnionQuery:

@cached_property
def query_date_range(self) -> QueryDateRangeWithIntervals:
total_intervals = self.query.retentionFilter.total_intervals or DEFAULT_TOTAL_INTERVALS
total_intervals = self.query.retentionFilter.totalIntervals or DEFAULT_TOTAL_INTERVALS
interval = (
IntervalType(self.query.retentionFilter.period.lower())
if self.query.retentionFilter.period
Expand Down

0 comments on commit 0fec76d

Please sign in to comment.