diff --git a/docker-app/qfieldcloud/core/management/commands/calcprojectstorage.py b/docker-app/qfieldcloud/core/management/commands/calcprojectstorage.py index 1e31d27fa..4ee6677e3 100644 --- a/docker-app/qfieldcloud/core/management/commands/calcprojectstorage.py +++ b/docker-app/qfieldcloud/core/management/commands/calcprojectstorage.py @@ -24,11 +24,16 @@ def handle(self, *args, **options): if not project_id and not force_recalculate: extra_filters["storage_size_mb"] = 0 - for project in Project.objects.filter( + projects_qs = Project.objects.filter( project_filename__isnull=False, **extra_filters, - ).order_by("-updated_at"): - print(f'Calculating project files storage size for "{project.id}"...') + ).order_by("-updated_at") + total_count = projects_qs.count() + + for idx, project in enumerate(projects_qs): + print( + f'Calculating project files storage size for "{project.id}" {idx}/{total_count}...' + ) project.save(recompute_storage=True) print( f'Project files storage size for "{project.id}" is {project.storage_size_mb}MB'