コード例 #1
0
    def calculate_funnel(self, request: request.Request) -> Dict[str, Any]:
        team = self.team
        filter = Filter(request=request, data={"insight": INSIGHT_FUNNELS}, team=self.team)

        if filter.funnel_viz_type == FunnelVizType.TRENDS:
            return {"result": ClickhouseFunnelTrends(team=team, filter=filter).run()}
        elif filter.funnel_viz_type == FunnelVizType.TIME_TO_CONVERT:
            return {"result": ClickhouseFunnelTimeToConvert(team=team, filter=filter).run()}
        else:
            funnel_order_class = get_funnel_order_class(filter)
            return {"result": funnel_order_class(team=team, filter=filter).run()}
コード例 #2
0
def _calculate_funnel(filter: Filter, key: str,
                      team_id: int) -> List[Dict[str, Any]]:
    team = Team(pk=team_id)

    if filter.funnel_viz_type == FunnelVizType.TRENDS:
        result = ClickhouseFunnelTrends(team=team, filter=filter).run()
    elif filter.funnel_viz_type == FunnelVizType.TIME_TO_CONVERT:
        result = ClickhouseFunnelTimeToConvert(team=team, filter=filter).run()
    else:
        funnel_order_class = get_funnel_order_class(filter)
        result = funnel_order_class(team=team, filter=filter).run()

    return result
コード例 #3
0
ファイル: funnel_trends.py プロジェクト: akbansa/posthog
    def __init__(self, filter: Filter, team: Team) -> None:

        super().__init__(filter, team)

        self.funnel_order = get_funnel_order_class(filter)(filter, team)
コード例 #4
0
 def test_filter_missing_order(self):
     filter = Filter({"foo": "bar"})
     self.assertEqual(get_funnel_order_class(filter), ClickhouseFunnel)
コード例 #5
0
 def test_ordered(self):
     filter = Filter({"funnel_order_type": FunnelOrderType.ORDERED})
     self.assertEqual(get_funnel_order_class(filter), ClickhouseFunnel)
コード例 #6
0
 def test_strict(self):
     filter = Filter({"funnel_order_type": FunnelOrderType.STRICT})
     self.assertEqual(get_funnel_order_class(filter),
                      ClickhouseFunnelStrict)