Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from django.core.management.base import BaseCommand
 
 
class Command(BaseCommand):
    help = 'Recalculate project stats (total_annotations, etc) for all organizations'
 
    def add_arguments(self, parser):
        parser.add_argument(
            '--from-scratch',
            dest='from_scratch',
            action='store_true',
            default=False,
            help='Start recalculation from scratch',
        )
        parser.add_argument(
            '--redis',
            dest='redis',
            action='store_true',
            default=False,
            help='Use rq workers with redis (async background processing)',
        )
 
    def handle(self, *args, **options):
        from tasks.functions import calculate_stats_all_orgs
 
        calculate_stats_all_orgs(from_scratch=options['from_scratch'], redis=options['redis'])