fix - comment quota stat on sale in warehouse signals
This commit is contained in:
@@ -8,17 +8,20 @@ class QuotaStatsService:
|
||||
|
||||
# origin org
|
||||
assigner = distribution.assigner_organization
|
||||
print(assigner)
|
||||
# destination org
|
||||
assigned = distribution.assigned_organization
|
||||
print(assigned)
|
||||
# ================ origin ================
|
||||
assigner_stat, _ = OrganizationQuotaStats.objects.get_or_create(
|
||||
assigner_stat, created = OrganizationQuotaStats.objects.get_or_create(
|
||||
organization=assigner,
|
||||
quota=quota,
|
||||
stat_type='distribution'
|
||||
)
|
||||
|
||||
if created:
|
||||
assigner_stat.stat_type = 'distribution'
|
||||
assigner_stat.save()
|
||||
print(assigner_stat.remaining_amount)
|
||||
assigner_stat.remaining_amount -= distribution.weight
|
||||
print(assigner_stat.remaining_amount)
|
||||
assigner_stat.total_distributed += distribution.weight
|
||||
assigner_stat.save()
|
||||
|
||||
@@ -60,8 +63,9 @@ class QuotaStatsService:
|
||||
assigner_stat.total_distributed += diff
|
||||
print(assigner_stat.total_distributed, diff)
|
||||
assigner_stat.save()
|
||||
|
||||
print(assigned_stat.total_amount)
|
||||
assigned_stat.total_amount += diff
|
||||
print(assigned_stat.total_amount)
|
||||
assigned_stat.remaining_amount += diff
|
||||
assigned_stat.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user