add - new pricing attr system

This commit is contained in:
2025-12-02 09:58:30 +03:30
parent 988e3aa1dd
commit e63c6b9b8d
6 changed files with 52 additions and 12 deletions

View File

@@ -7,7 +7,6 @@ class QuotaStatsService:
@staticmethod
def apply_distribution(distribution: QuotaDistribution):
quota = distribution.quota
print("ssss")
# origin org
assigner = distribution.assigner_organization
# destination org
@@ -24,10 +23,12 @@ class QuotaStatsService:
organization=assigner,
quota=quota,
)
print(assigner_stat.id)
if created:
assigner_stat.stat_type = 'distribution'
assigner_stat.save()
if assigner_stat.stat_type == 'distribution':
print(assigner_stat.remaining_amount)
assigner_stat.remaining_amount -= distribution.weight
assigner_stat.total_distributed += distribution.weight
assigner_stat.save()
@@ -38,7 +39,7 @@ class QuotaStatsService:
quota=quota,
stat_type='distribution'
)
print(distribution._request) # noqa
assigned_stat.total_amount += distribution.weight
assigned_stat.remaining_amount += distribution.weight
assigned_stat.distributions.add(distribution)