fix - import stat type in orgquotastat
This commit is contained in:
@@ -14,7 +14,8 @@ class QuotaStatsService:
|
||||
# ================ origin ================
|
||||
assigner_stat, _ = OrganizationQuotaStats.objects.get_or_create(
|
||||
organization=assigner,
|
||||
quota=quota
|
||||
quota=quota,
|
||||
stat_type='distribution'
|
||||
)
|
||||
|
||||
assigner_stat.remaining_amount -= distribution.weight
|
||||
@@ -24,7 +25,8 @@ class QuotaStatsService:
|
||||
# ============== destination ================
|
||||
assigned_stat, _ = OrganizationQuotaStats.objects.get_or_create(
|
||||
organization=assigned,
|
||||
quota=quota
|
||||
quota=quota,
|
||||
stat_type='distribution'
|
||||
)
|
||||
|
||||
assigned_stat.total_amount += distribution.weight
|
||||
@@ -51,15 +53,16 @@ class QuotaStatsService:
|
||||
organization=assigned,
|
||||
quota=quota
|
||||
)
|
||||
# if diff > 0 it is added to destination
|
||||
assigner_stat.remaining_amount -= diff
|
||||
assigner_stat.total_distributed += diff
|
||||
assigner_stat.save()
|
||||
if assigner_stat.stat_type == 'distribution':
|
||||
# if diff > 0 it is added to destination
|
||||
assigner_stat.remaining_amount -= diff
|
||||
print("distributed : ", assigner_stat.total_distributed)
|
||||
assigner_stat.total_distributed += diff
|
||||
print(assigner_stat.total_distributed, diff)
|
||||
assigner_stat.save()
|
||||
|
||||
assigned_stat.total_amount += diff
|
||||
assigned_stat.remaining_amount += diff
|
||||
print(assigned_stat.id)
|
||||
|
||||
assigned_stat.save()
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user