diff --git a/apps/product/management/commands/rebuild_org_quota_stats.py b/apps/product/management/commands/rebuild_org_quota_stats.py index cf56d23..3aacc92 100644 --- a/apps/product/management/commands/rebuild_org_quota_stats.py +++ b/apps/product/management/commands/rebuild_org_quota_stats.py @@ -19,8 +19,9 @@ class Command(BaseCommand): merged = 0 for quota in quotas: - create_org_stat_by_quota(quota) - create_org_stat_by_distribution(quota) + # create_org_stat_by_quota(quota) + # create_org_stat_by_distribution(quota) + update_quota_assigned_organizations(quota) def create_org_stat_by_quota(quota: Quota): @@ -78,3 +79,9 @@ def create_org_stat_by_distribution(quota: Quota): print(org_quota_stat) print('created:', created, '\n', 'was_created:', was_created) + + +def update_quota_assigned_organizations(quota: Quota): + distributions = quota.distributions_assigned.all() + for dist in distributions: + quota.assigned_organizations.add(dist.assigned_organization)