fix: favourite cycle and modules displayed at top (#2719)

This commit is contained in:
Bavisetti Narayan 2023-11-09 18:22:38 +05:30 committed by GitHub
parent 894ffb6c21
commit 630e21b954
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -176,9 +176,8 @@ class CycleViewSet(BaseViewSet):
def list(self, request, slug, project_id): def list(self, request, slug, project_id):
queryset = self.get_queryset() queryset = self.get_queryset()
cycle_view = request.GET.get("cycle_view", "all") cycle_view = request.GET.get("cycle_view", "all")
order_by = request.GET.get("order_by", "sort_order")
queryset = queryset.order_by(order_by) queryset = queryset.order_by("-is_favorite","-created_at")
# Current Cycle # Current Cycle
if cycle_view == "current": if cycle_view == "current":

View File

@ -55,7 +55,6 @@ class ModuleViewSet(BaseViewSet):
) )
def get_queryset(self): def get_queryset(self):
order_by = self.request.GET.get("order_by", "sort_order")
subquery = ModuleFavorite.objects.filter( subquery = ModuleFavorite.objects.filter(
user=self.request.user, user=self.request.user,
@ -138,7 +137,7 @@ class ModuleViewSet(BaseViewSet):
), ),
) )
) )
.order_by(order_by, "name") .order_by("-is_favorite","-created_at")
) )
def create(self, request, slug, project_id): def create(self, request, slug, project_id):