🐛(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:
committed by
Anthony LC
parent
774c2ce248
commit
1899cff572
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user