fix - bug of edit price features in distribution

This commit is contained in:
2025-12-02 16:16:49 +03:30
parent 262a9275b7
commit f882b9380f
2 changed files with 16 additions and 6 deletions

View File

@@ -86,8 +86,6 @@ class QuotaStatsService:
@staticmethod
def update_distribution(distribution: QuotaDistribution, old_weight: int):
diff = distribution.weight - old_weight
if diff == 0:
return
quota = distribution.quota
@@ -110,6 +108,14 @@ class QuotaStatsService:
organization=assigned,
quota=quota
)
# create pricing attributes and broker pricing data
data = json.loads(get_current_request_body().decode())
import_price_features(data, assigned_stat, quota)
if diff == 0:
return
if assigner_stat.stat_type == 'distribution':
# if diff > 0 it is added to destination
assigner_stat.remaining_amount -= diff
@@ -119,10 +125,6 @@ class QuotaStatsService:
assigned_stat.remaining_amount += diff
assigned_stat.save()
# create pricing attributes and broker pricing data
data = json.loads(get_current_request_body().decode())
import_price_features(data, assigned_stat, quota)
@staticmethod
def delete_distribution(distribution: QuotaDistribution):
quota = distribution.quota