mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
a1dd96e47d
* Improve cached_property typing Noticed that e.g. `filter.breakdown` was getting inferred to be `Any` which is not correct. Added generics to fix it :) * Proposed fix: make filter_test_accounts return a bool always * Fix warning in clickhouse_sessions.py * Cast in session.events * Cast 2x in funnel queries * Ignore error in session recording We know the valid values here * Add assertions in stickiness filters * Cast in more funnel queries * Untyped dict where inferred type is wrong * Add types to abstract methods * Type prop_vals * Add a lot of casts These are correct. We should really validate while parsing instead * Add more casts to funnel trends * Last fixes
22 lines
836 B
Python
22 lines
836 B
Python
from typing import cast
|
|
|
|
from ee.clickhouse.queries.funnels.funnel_strict import ClickhouseFunnelStrict
|
|
from ee.clickhouse.sql.funnels.funnel import FUNNEL_PERSONS_BY_STEP_SQL
|
|
from posthog.models import Person
|
|
|
|
|
|
class ClickhouseFunnelStrictPersons(ClickhouseFunnelStrict):
|
|
def get_query(self):
|
|
return FUNNEL_PERSONS_BY_STEP_SQL.format(
|
|
offset=self._filter.offset,
|
|
steps_per_person_query=self.get_step_counts_query(),
|
|
persons_steps=self._get_funnel_person_step_condition(),
|
|
)
|
|
|
|
def _format_results(self, results):
|
|
people = Person.objects.filter(team_id=self._team.pk, uuid__in=[val[0] for val in results])
|
|
|
|
from posthog.api.person import PersonSerializer
|
|
|
|
return PersonSerializer(people, many=True).data, len(results) > cast(int, self._filter.limit) - 1
|