Skip to content

Commit

Permalink
fix: only sort peer reviewers by last name without a query
Browse files Browse the repository at this point in the history
always ordering by mb__user__last_name would fail when there was a query,
either way we should order by relevance instead
  • Loading branch information
sgfost committed Nov 4, 2024
1 parent 3a57414 commit 1604bc6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions django/library/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ class PeerReviewerFilter(filters.BaseFilterBackend):
def filter_queryset(self, request, queryset, view):
query = request.query_params.get("query", None)
if query is None:
return queryset
return get_search_queryset(query, queryset)
return queryset.order_by("member_profile__user__last_name")
return get_search_queryset(query, queryset, order_by_relevance=True)


class PeerReviewerPermission(permissions.BasePermission):
Expand All @@ -217,7 +217,7 @@ def _is_creating_self_reviewer(self, request):


class PeerReviewerViewSet(CommonViewSetMixin, NoDeleteViewSet):
queryset = PeerReviewer.objects.all().order_by("member_profile__user__last_name")
queryset = PeerReviewer.objects.all()
pagination_class = None
serializer_class = PeerReviewerSerializer
permission_classes = (PeerReviewerPermission,)
Expand Down

0 comments on commit 1604bc6

Please sign in to comment.