Commit c96d182d authored by Eliot Berriot's avatar Eliot Berriot 💬

Merge branch '581-0-tracks-library' into 'develop'

Fixed #581: missing track count on various library cards

Closes #581

See merge request funkwhale/funkwhale!455
parents a6264d7d 2b70f3ba
......@@ -35,7 +35,7 @@ def get_libraries(filter_uploads):
uploads = uploads.playable_by(actor)
libraries = models.Library.objects.filter(
pk__in=uploads.values_list("library", flat=True)
)
).annotate(_uploads_count=Count("uploads"))
libraries = libraries.select_related("actor")
page = self.paginate_queryset(libraries)
if page is not None:
......
......@@ -462,6 +462,7 @@ def test_can_get_libraries_for_music_entities(
import_status="finished", library__privacy_level="me", track=upload.track
).library
library = upload.library
setattr(library, "_uploads_count", 1)
data = {
"artist": upload.track.artist,
"album": upload.track.album,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment