Skip to content

Commit

Permalink
Improve schedule filters before generating user calendar export (#4950)
Browse files Browse the repository at this point in the history
Avoid checking all schedules in an organization when filtering user
events during export.
This should help with some slow requests we are noticing.
  • Loading branch information
matiasb authored Aug 29, 2024
1 parent 754fa87 commit f5be809
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion engine/apps/public_api/views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def get_object(self):
permission_classes=(IsAuthenticated,),
)
def schedule_export(self, request, pk):
schedules = OnCallSchedule.objects.filter(organization=self.request.auth.organization)
schedules = OnCallSchedule.objects.filter(organization=self.request.auth.organization).related_to_user(
self.request.user
)
export = user_ical_export(self.request.user, schedules)
return Response(export)

0 comments on commit f5be809

Please sign in to comment.