fix - distribution add calcualte remaining/ditributed weight on quota stat

This commit is contained in:
2025-11-17 12:27:51 +03:30
parent 78ddd9cdeb
commit 7886c19c58

View File

@@ -8,7 +8,6 @@ class QuotaStatsService:
# origin org
assigner = distribution.assigner_organization
print(assigner)
# destination org
assigned = distribution.assigned_organization
# ================ origin ================
@@ -19,9 +18,8 @@ class QuotaStatsService:
if created:
assigner_stat.stat_type = 'distribution'
assigner_stat.save()
print(assigner_stat.remaining_amount)
if assigner_stat.stat_type == 'distribution':
assigner_stat.remaining_amount -= distribution.weight
print(assigner_stat.remaining_amount)
assigner_stat.total_distributed += distribution.weight
assigner_stat.save()
@@ -78,6 +76,7 @@ class QuotaStatsService:
organization=distribution.assigner_organization,
quota=quota
)
if assigner_stat.stat_type == 'distribution':
assigner_stat.remaining_amount += distribution.weight
assigner_stat.total_distributed -= distribution.weight
assigner_stat.save()