mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 12:09:23 +02:00
Fix #1011: Ensure tracks linked to skipped upload can be pruned
This commit is contained in:
parent
8cd40699e8
commit
c7a3dd9da5
3 changed files with 11 additions and 2 deletions
|
@ -817,9 +817,15 @@ def get_prunable_tracks(
|
|||
Returns a list of tracks with no associated uploads,
|
||||
excluding the one that were listened/favorited/included in playlists.
|
||||
"""
|
||||
|
||||
purgeable_tracks_with_upload = (
|
||||
models.Upload.objects.exclude(track=None)
|
||||
.filter(import_status="skipped")
|
||||
.values("track")
|
||||
)
|
||||
queryset = models.Track.objects.all()
|
||||
queryset = queryset.filter(uploads__isnull=True)
|
||||
queryset = queryset.filter(
|
||||
Q(uploads__isnull=True) | Q(pk__in=purgeable_tracks_with_upload)
|
||||
)
|
||||
if exclude_favorites:
|
||||
queryset = queryset.filter(track_favorites__isnull=True)
|
||||
if exclude_playlists:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue