Skip to content

Commit

Permalink
returning
Browse files Browse the repository at this point in the history
  • Loading branch information
EDsCODE committed Mar 15, 2024
1 parent 150ffa2 commit ac75ac5
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions posthog/hogql_queries/insights/trends/trends_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
HogQLQueryModifiers,
DataWarehouseEventsModifier,
)
from posthog.warehouse.models import DataWarehouseTable
from posthog.utils import format_label_date


Expand Down Expand Up @@ -696,18 +697,33 @@ def _is_breakdown_field_boolean(self):
):
return False

if self.query.breakdownFilter.breakdown_type == "person":
property_type = PropertyDefinition.Type.PERSON
elif self.query.breakdownFilter.breakdown_type == "group":
property_type = PropertyDefinition.Type.GROUP
if self.query.breakdownFilter.breakdown_type == "data_warehouse":
series = self.query.series[0] # only one series when data warehouse is active
table_model = (
DataWarehouseTable.objects.filter(name=series.table_name, team=self.team).exclude(deleted=True).first()

Check failure on line 703 in posthog/hogql_queries/insights/trends/trends_query_runner.py

View workflow job for this annotation

GitHub Actions / Python code quality checks

Item "EventsNode" of "EventsNode | ActionsNode | DataWarehouseNode" has no attribute "table_name"

Check failure on line 703 in posthog/hogql_queries/insights/trends/trends_query_runner.py

View workflow job for this annotation

GitHub Actions / Python code quality checks

Item "ActionsNode" of "EventsNode | ActionsNode | DataWarehouseNode" has no attribute "table_name"
)

field_type = table_model.columns[self.query.breakdownFilter.breakdown]

Check failure on line 706 in posthog/hogql_queries/insights/trends/trends_query_runner.py

View workflow job for this annotation

GitHub Actions / Python code quality checks

Item "None" of "DataWarehouseTable | None" has no attribute "columns"

Check failure on line 706 in posthog/hogql_queries/insights/trends/trends_query_runner.py

View workflow job for this annotation

GitHub Actions / Python code quality checks

Value of type "JSONField | Any" is not indexable

if field_type.startswith("Nullable("):
field_type = field_type.replace("Nullable(", "")[:-1]

if field_type == "Bool":
return True

else:
property_type = PropertyDefinition.Type.EVENT
if self.query.breakdownFilter.breakdown_type == "person":
property_type = PropertyDefinition.Type.PERSON
elif self.query.breakdownFilter.breakdown_type == "group":
property_type = PropertyDefinition.Type.GROUP
else:
property_type = PropertyDefinition.Type.EVENT

field_type = self._event_property(
self.query.breakdownFilter.breakdown,
property_type,
self.query.breakdownFilter.breakdown_group_type_index,
)
field_type = self._event_property(
self.query.breakdownFilter.breakdown,
property_type,
self.query.breakdownFilter.breakdown_group_type_index,
)
return field_type == "Boolean"

def _convert_boolean(self, value: Any):
Expand Down

0 comments on commit ac75ac5

Please sign in to comment.