fix - distribution add calcualte remaining/ditributed weight on quota stat
This commit is contained in:
@@ -8,7 +8,6 @@ class QuotaStatsService:
|
|||||||
|
|
||||||
# origin org
|
# origin org
|
||||||
assigner = distribution.assigner_organization
|
assigner = distribution.assigner_organization
|
||||||
print(assigner)
|
|
||||||
# destination org
|
# destination org
|
||||||
assigned = distribution.assigned_organization
|
assigned = distribution.assigned_organization
|
||||||
# ================ origin ================
|
# ================ origin ================
|
||||||
@@ -19,9 +18,8 @@ class QuotaStatsService:
|
|||||||
if created:
|
if created:
|
||||||
assigner_stat.stat_type = 'distribution'
|
assigner_stat.stat_type = 'distribution'
|
||||||
assigner_stat.save()
|
assigner_stat.save()
|
||||||
print(assigner_stat.remaining_amount)
|
if assigner_stat.stat_type == 'distribution':
|
||||||
assigner_stat.remaining_amount -= distribution.weight
|
assigner_stat.remaining_amount -= distribution.weight
|
||||||
print(assigner_stat.remaining_amount)
|
|
||||||
assigner_stat.total_distributed += distribution.weight
|
assigner_stat.total_distributed += distribution.weight
|
||||||
assigner_stat.save()
|
assigner_stat.save()
|
||||||
|
|
||||||
@@ -78,6 +76,7 @@ class QuotaStatsService:
|
|||||||
organization=distribution.assigner_organization,
|
organization=distribution.assigner_organization,
|
||||||
quota=quota
|
quota=quota
|
||||||
)
|
)
|
||||||
|
if assigner_stat.stat_type == 'distribution':
|
||||||
assigner_stat.remaining_amount += distribution.weight
|
assigner_stat.remaining_amount += distribution.weight
|
||||||
assigner_stat.total_distributed -= distribution.weight
|
assigner_stat.total_distributed -= distribution.weight
|
||||||
assigner_stat.save()
|
assigner_stat.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user