🐛(backend) fix flaky test by clarifying user ordering

On the user search API by similarity, we had a flaky test because
2 users had the same similarity score. Adding a secondary ordering
field makes ordering deterministic between users who share the same
similarity score.
This commit is contained in:
Samuel Paccoud - DINUM
2024-11-12 11:48:04 +01:00
committed by Anthony LC
parent 774c2ce248
commit 1899cff572

View File

@@ -175,7 +175,7 @@ class UserViewSet(
threshold = 0.6 if "@" in query else 0.1 threshold = 0.6 if "@" in query else 0.1
queryset = queryset.filter(similarity__gt=threshold).order_by( queryset = queryset.filter(similarity__gt=threshold).order_by(
"-similarity" "-similarity", "email"
) )
return queryset return queryset