0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00

Fix flaky person test (#2221)

* Fix flaky person test

* Black

Co-authored-by: Michael Matloka <dev@twixes.com>
This commit is contained in:
Tim Glaser 2020-11-04 16:16:24 +00:00 committed by GitHub
parent 1942729819
commit 820ac84039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,7 +162,10 @@ class PersonViewSet(viewsets.ModelViewSet):
people = self.get_queryset()
people = (
people.annotate(keys=JsonKeys("properties")).values("keys").annotate(count=Count("id")).order_by("-count")
people.annotate(keys=JsonKeys("properties"))
.values("keys")
.annotate(count=Count("id"))
.order_by("-count", "keys")
)
return [{"name": event["keys"], "count": event["count"]} for event in people]