mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 20:19:16 +02:00
Fix #570: Exclude in-place imported files from quota computation
This commit is contained in:
parent
97ef15906d
commit
cc71d2bb20
4 changed files with 39 additions and 3 deletions
|
@ -51,11 +51,15 @@ class ActorQuerySet(models.QuerySet):
|
|||
def with_current_usage(self):
|
||||
qs = self
|
||||
for s in ["pending", "skipped", "errored", "finished"]:
|
||||
uploads_query = models.Q(
|
||||
libraries__uploads__import_status=s,
|
||||
libraries__uploads__audio_file__isnull=False,
|
||||
libraries__uploads__audio_file__ne="",
|
||||
)
|
||||
qs = qs.annotate(
|
||||
**{
|
||||
"_usage_{}".format(s): models.Sum(
|
||||
"libraries__uploads__size",
|
||||
filter=models.Q(libraries__uploads__import_status=s),
|
||||
"libraries__uploads__size", filter=uploads_query
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue