# Improves filter_show_all()
* improves performance for filter_show_all() in ShareableTableFilterMixin and CheckboxCompensationTableFilter by ~40%
This commit is contained in:
parent
6653269427
commit
799b97341a
@ -55,10 +55,12 @@ class CheckboxCompensationTableFilter(CheckboxTableFilter):
|
||||
|
||||
"""
|
||||
if not value:
|
||||
return queryset.filter(
|
||||
user_teams = self.user.shared_teams
|
||||
result = queryset.filter(
|
||||
Q(intervention__users__in=[self.user]) | # requesting user has access
|
||||
Q(intervention__teams__in=self.user.shared_teams)
|
||||
Q(intervention__teams__in=user_teams)
|
||||
).distinct()
|
||||
return result
|
||||
else:
|
||||
return queryset
|
||||
|
||||
|
@ -50,9 +50,11 @@ class ShareableTableFilterMixin(django_filters.FilterSet):
|
||||
|
||||
"""
|
||||
if not value:
|
||||
return queryset.filter(
|
||||
user_teams = self.user.shared_teams
|
||||
result = queryset.filter(
|
||||
Q(users__in=[self.user]) | # requesting user has access
|
||||
Q(teams__in=self.user.shared_teams)
|
||||
Q(teams__in=user_teams)
|
||||
).distinct()
|
||||
return result
|
||||
else:
|
||||
return queryset
|
Loading…
Reference in New Issue
Block a user