示例#1
0
        def test_calculate_cohorts(self) -> None:
            FeatureFlag.objects.create(
                team=self.team,
                filters={
                    "groups": [{
                        "properties": [{
                            "key": "id",
                            "type": "cohort",
                            "value": 267
                        }],
                        "rollout_percentage":
                        None
                    }]
                },
                key="default-flag-1",
                created_by=self.user,
            )

            FeatureFlag.objects.create(
                team=self.team,
                filters={
                    "groups": [{
                        "properties": [
                            {
                                "key": "id",
                                "type": "cohort",
                                "value": 22
                            },
                            {
                                "key": "id",
                                "type": "cohort",
                                "value": 35
                            },
                        ],
                        "rollout_percentage":
                        None,
                    }]
                },
                key="default-flag-2",
                created_by=self.user,
            )

            calculate_cohorts()
示例#2
0
def calculate_cohort():
    from posthog.tasks.calculate_cohort import calculate_cohorts

    calculate_cohorts()