fix --> recieved & sent dist tags

This commit is contained in:
2026-01-24 14:09:07 +03:30
parent b4997da6b7
commit c3511590b7

View File

@@ -3,6 +3,7 @@ import random
from django.db import transaction
from django.db.models import Sum, Q
from django.db.models.aggregates import Count
from django.db.models.functions import Coalesce
from apps.authentication.models import Organization
from apps.tag.exceptions import TagException
@@ -170,8 +171,8 @@ class TagDistributionService:
data = distributions_batch.aggregate(
count=Count('id'),
total_sent_tag_count=Sum('total_tag_count', filter=Q(assigner_org=org)),
total_recieved_tag_count=Sum('total_tag_count', filter=Q(assigned_org=org)),
total_sent_tag_count=Coalesce(Sum('total_tag_count', filter=Q(assigner_org=org)), 0),
total_recieved_tag_count=Coalesce(Sum('total_tag_count', filter=Q(assigned_org=org)), 0),
total_recieved_distributions=Count('id', filter=Q(assigned_org=org)),
total_sent_distributions=Count('id', filter=Q(assigner_org=org)),
total_distributed_tag_count=Sum('total_distributed_tag_count'),