fix - calculate distributions in quota remainng signal with assigner organization
This commit is contained in:
@@ -66,16 +66,18 @@ class PermissionSerializer(serializers.ModelSerializer):
|
||||
|
||||
grouped = defaultdict(set)
|
||||
modifier_states = defaultdict(set)
|
||||
# {'name': permission.name, 'modify_stat': permission.modify_state}
|
||||
|
||||
for permission in permissions:
|
||||
if getattr(permission, 'is_active', True):
|
||||
|
||||
page_name = getattr(permission.page, 'name', None)
|
||||
|
||||
if page_name:
|
||||
grouped[page_name].add(permission.name)
|
||||
grouped[f'modify_state_{page_name}'].add(permission.modify_state)
|
||||
modifier_states[page_name].add(permission.modify_state)
|
||||
structure = []
|
||||
|
||||
structure = []
|
||||
for page, access in grouped.items():
|
||||
if page.startswith('modify_state_'):
|
||||
continue
|
||||
|
||||
@@ -24,6 +24,7 @@ def recalculate_remaining_amount(quota):
|
||||
""" calculate remaining weight from distribution """
|
||||
total_distributed = quota.distributions_assigned.filter(
|
||||
parent_distribution__isnull=True,
|
||||
assigner_organization=quota.registerer_organization,
|
||||
trash=False,
|
||||
).aggregate(
|
||||
total=Sum('weight')
|
||||
|
||||
Reference in New Issue
Block a user