diff --git a/apps/tag/services/tag_batch_service.py b/apps/tag/services/tag_batch_service.py index d46d3b9..46aca15 100644 --- a/apps/tag/services/tag_batch_service.py +++ b/apps/tag/services/tag_batch_service.py @@ -25,8 +25,9 @@ class TagBatchService: base_data = qs.aggregate( batch_count=Count('id', distinct=True), - total_distributed_tags=Coalesce(Sum('total_distributed_tags', distinct=True), 0), - total_remaining_tags=Coalesce(Sum('total_remaining_tags'), 0), + total_distributed_tags=Coalesce(Sum('total_distributed_tags'), 0), + total_remaining_tags=Coalesce(Sum('total_remaining_tags'), 0) / + Coalesce(Sum('total_remaining_tags', distinct=True), 0), tag_count_created_by_batch=Count('tag'), has_distributed_batches_number=Count( 'id',