Skip to content

Commit

Permalink
fix cohort
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Dec 5, 2023
1 parent cbb759d commit 0a8fe92
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions posthog/api/cohort.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from posthog.metrics import LABEL_TEAM_ID
from posthog.renderers import SafeJSONRenderer
from datetime import datetime
from typing import Any, Dict, cast
from typing import Any, Dict, cast, Optional

from django.conf import settings
from django.db.models import QuerySet, Prefetch, prefetch_related_objects, OuterRef, Subquery
Expand Down Expand Up @@ -175,7 +175,9 @@ def _calculate_static_by_csv(self, file, cohort: Cohort) -> None:
distinct_ids_and_emails = [row[0] for row in reader if len(row) > 0 and row]
calculate_cohort_from_list.delay(cohort.pk, distinct_ids_and_emails)

def validate_query(self, query: Dict) -> Dict:
def validate_query(self, query: Optional[Dict]) -> Optional[Dict]:
if not query:
return None
if not isinstance(query, dict):
raise ValidationError("Query must be a dictionary.")
if query.get("kind") != "PersonsQuery":
Expand Down

0 comments on commit 0a8fe92

Please sign in to comment.