import --> total recieved tag count on main dashboerd
This commit is contained in:
18
apps/tag/migrations/0041_tagbatch_total_remaining_tags.py
Normal file
18
apps/tag/migrations/0041_tagbatch_total_remaining_tags.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0 on 2026-01-24 10:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('tag', '0040_tagdistributionbatch_parent'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='tagbatch',
|
||||
name='total_remaining_tags',
|
||||
field=models.PositiveBigIntegerField(default=0),
|
||||
),
|
||||
]
|
||||
@@ -70,6 +70,7 @@ class TagBatch(BaseModel):
|
||||
serial_from = models.PositiveBigIntegerField(default=0)
|
||||
serial_to = models.PositiveBigIntegerField(default=0)
|
||||
total_distributed_tags = models.PositiveBigIntegerField(default=0)
|
||||
total_remaining_tags = models.PositiveBigIntegerField(default=0)
|
||||
|
||||
status = models.CharField(
|
||||
max_length=20,
|
||||
|
||||
@@ -170,7 +170,8 @@ class TagDistributionService:
|
||||
|
||||
data = distributions_batch.aggregate(
|
||||
count=Count('id'),
|
||||
total_tag_count=Sum('total_tag_count'),
|
||||
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_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'),
|
||||
|
||||
Reference in New Issue
Block a user