Remove duplicates from last scanned list
This commit is contained in:
parent
5a30f60d6e
commit
33aaf68c5e
|
@ -124,7 +124,9 @@ class SearchViewSet(Base, Retrieve):
|
||||||
elif sort == 'last_scanned':
|
elif sort == 'last_scanned':
|
||||||
if self.request.user.member.allow_last_scanned:
|
if self.request.user.member.allow_last_scanned:
|
||||||
queryset = queryset.filter(allow_last_scanned=True)
|
queryset = queryset.filter(allow_last_scanned=True)
|
||||||
queryset = queryset.order_by('-user__cards__last_seen')
|
queryset = queryset.annotate(
|
||||||
|
last_scanned=Max('user__cards__last_seen'),
|
||||||
|
).exclude(last_scanned__isnull=True).order_by('-last_scanned')
|
||||||
else:
|
else:
|
||||||
queryset = []
|
queryset = []
|
||||||
elif sort == 'everyone':
|
elif sort == 'everyone':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user