fix --> bug of calculate remaining tags of distribution parent batch

This commit is contained in:
2026-02-02 11:24:37 +03:30
parent 74a870380e
commit 0dd145131f

View File

@@ -53,11 +53,14 @@ def calculate_tag_distribution_detail(sender, instance: TagDistributionBatch, **
tag_dist_batch = instance
parent = tag_dist_batch.parent
if parent:
# parent.total_distributed_tag_count += tag_dist_batch.total_tag_count
parent.remaining_tag_count = 20
print(parent.remaining_tag_count)
parent.save(update_fields=['remaining_tag_count'])
parent.total_distributed_tag_count += tag_dist_batch.total_tag_count
parent.remaining_tag_count = (
parent.total_tag_count - parent.total_distributed_tag_count
)
parent.parent_flag = True
parent.save(update_fields=['remaining_tag_count', 'total_distributed_tag_count'])
if not getattr(instance, 'parent_flag', False):
tag_dist_batch.remaining_tag_count = tag_dist_batch.total_tag_count
instance.flag = True
tag_dist_batch.save(update_fields=['remaining_tag_count'])