Skip to content

Commit

Permalink
added order by in log retrieval endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jabelone committed Oct 5, 2023
1 parent d09f0e2 commit efa9892
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions memberportal/api_admin_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,9 @@ def get(self, request, member_id):
door_logs = []
interlock_logs = []

for user_event_log in UserEventLog.objects.filter(user=user)[:1000]:
for user_event_log in UserEventLog.objects.order_by("-date").filter(user=user)[
:1000
]:
user_event_logs.append(
{
"date": user_event_log.date,
Expand All @@ -663,7 +665,7 @@ def get(self, request, member_id):
}
)

for door_log in DoorLog.objects.filter(user=user)[:1000]:
for door_log in DoorLog.objects.order_by("-date").filter(user=user)[:500]:
door_logs.append(
{
"date": door_log.date,
Expand Down

0 comments on commit efa9892

Please sign in to comment.