fix --> recieved & sent dist tags
This commit is contained in:
@@ -3,6 +3,7 @@ import random
|
|||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Sum, Q
|
from django.db.models import Sum, Q
|
||||||
from django.db.models.aggregates import Count
|
from django.db.models.aggregates import Count
|
||||||
|
from django.db.models.functions import Coalesce
|
||||||
|
|
||||||
from apps.authentication.models import Organization
|
from apps.authentication.models import Organization
|
||||||
from apps.tag.exceptions import TagException
|
from apps.tag.exceptions import TagException
|
||||||
@@ -170,8 +171,8 @@ class TagDistributionService:
|
|||||||
|
|
||||||
data = distributions_batch.aggregate(
|
data = distributions_batch.aggregate(
|
||||||
count=Count('id'),
|
count=Count('id'),
|
||||||
total_sent_tag_count=Sum('total_tag_count', filter=Q(assigner_org=org)),
|
total_sent_tag_count=Coalesce(Sum('total_tag_count', filter=Q(assigner_org=org)), 0),
|
||||||
total_recieved_tag_count=Sum('total_tag_count', filter=Q(assigned_org=org)),
|
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_recieved_distributions=Count('id', filter=Q(assigned_org=org)),
|
||||||
total_sent_distributions=Count('id', filter=Q(assigner_org=org)),
|
total_sent_distributions=Count('id', filter=Q(assigner_org=org)),
|
||||||
total_distributed_tag_count=Sum('total_distributed_tag_count'),
|
total_distributed_tag_count=Sum('total_distributed_tag_count'),
|
||||||
|
|||||||
Reference in New Issue
Block a user