perf: 修复 Count 时没有去重的问题

This commit is contained in:
Bai
2024-01-18 19:43:55 +08:00
committed by 老广
parent 37a0d831da
commit dc79346bdc
10 changed files with 17 additions and 15 deletions

View File

@@ -246,6 +246,6 @@ class UsernameHintsAPI(APIView):
.filter(username__icontains=query) \
.filter(asset__in=assets) \
.values('username') \
.annotate(total=Count('username')) \
.annotate(total=Count('username', distinct=True)) \
.order_by('total', '-username')[:10]
return Response(data=top_accounts)