Improve schedule filters before generating user calendar export (#4950)
Avoid checking all schedules in an organization when filtering user events during export. This should help with some slow requests we are noticing.
This commit is contained in:
parent
754fa8728e
commit
f5be809b47
1 changed files with 3 additions and 1 deletions
|
|
@ -84,6 +84,8 @@ class UserView(RateLimitHeadersMixin, ShortSerializerMixin, ReadOnlyModelViewSet
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue