Skip to content

Commit

Permalink
Fix: Updated the users page, ordered by the first_name, reduced the p…
Browse files Browse the repository at this point in the history
…age size to 10
  • Loading branch information
Mahmoud-Emad committed Jan 29, 2024
1 parent 29545cf commit 4b8fb3d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/cshr/services/users.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This file will containes everything related to User model."""
from django.contrib.auth.hashers import check_password
from django.db.models import Q
from django.db.models import Q, F
from typing import List, Union
from cshr.models.office import Office

Expand Down Expand Up @@ -84,9 +84,11 @@ def get_all_of_users(options=None) -> User:
"""Return all users"""
if options:
return User.objects.filter(location__id=options["location"]["id"]).order_by(
"first_name"
).order_by("-is_active")
return User.objects.all().order_by("first_name").order_by("-is_active")
"first_name", F("is_active").desc(nulls_last=True)
)
return User.objects.all().order_by(
"first_name", F("is_active").desc(nulls_last=True)
)


def get_admin_office_users(admin: User) -> User:
Expand Down

0 comments on commit 4b8fb3d

Please sign in to comment.