Skip to content

Commit

Permalink
Merge pull request #392 from opengisch/improve-calcstorage-feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus authored Aug 12, 2022
2 parents e564c12 + e1396d1 commit 5a05309
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 5a05309

Please sign in to comment.