fix - bug of stat type in quota stat service
This commit is contained in:
@@ -59,14 +59,11 @@ class QuotaStatsService:
|
|||||||
assigner_stat, created = OrganizationQuotaStats.objects.get_or_create(
|
assigner_stat, created = OrganizationQuotaStats.objects.get_or_create(
|
||||||
organization=assigner,
|
organization=assigner,
|
||||||
quota=quota,
|
quota=quota,
|
||||||
|
stat_type='distribution'
|
||||||
)
|
)
|
||||||
if created:
|
assigner_stat.remaining_amount -= distribution.weight
|
||||||
assigner_stat.stat_type = 'distribution'
|
assigner_stat.total_distributed += distribution.weight
|
||||||
assigner_stat.save()
|
assigner_stat.save()
|
||||||
if assigner_stat.stat_type == 'distribution':
|
|
||||||
assigner_stat.remaining_amount -= distribution.weight
|
|
||||||
assigner_stat.total_distributed += distribution.weight
|
|
||||||
assigner_stat.save()
|
|
||||||
|
|
||||||
# ============== destination ================
|
# ============== destination ================
|
||||||
assigned_stat, _ = OrganizationQuotaStats.objects.get_or_create(
|
assigned_stat, _ = OrganizationQuotaStats.objects.get_or_create(
|
||||||
@@ -102,11 +99,13 @@ class QuotaStatsService:
|
|||||||
|
|
||||||
assigner_stat = OrganizationQuotaStats.objects.get(
|
assigner_stat = OrganizationQuotaStats.objects.get(
|
||||||
organization=assigner,
|
organization=assigner,
|
||||||
quota=quota
|
quota=quota,
|
||||||
|
stat_type='distribution'
|
||||||
)
|
)
|
||||||
assigned_stat = OrganizationQuotaStats.objects.get(
|
assigned_stat = OrganizationQuotaStats.objects.get(
|
||||||
organization=assigned,
|
organization=assigned,
|
||||||
quota=quota
|
quota=quota,
|
||||||
|
stat_type='distribution'
|
||||||
)
|
)
|
||||||
|
|
||||||
# create pricing attributes and broker pricing data
|
# create pricing attributes and broker pricing data
|
||||||
|
|||||||
Reference in New Issue
Block a user