Add GET /api/v1/statistics/soundtracks with every soundtrack and its songs
The other soundtrack statistics are capped at 100, so a client that shows every soundtrack (the MusicPlayer statistics tab) had no way to get them all. This one has no limit and is sorted by name.
This commit is contained in:
1 parent
fc7d787014
commit
080bacae80
9 files changed
+147
-1
No files matched your search
@@ -70,6 +70,22 @@ func TestLibraryAndStatisticsWithPostgres(t *testing.T) {
|
||||
assert.Equal(t, song.Uuid, songs[0].SongUuid)
|
||||
assert.Equal(t, bird.Uuid, songs[0].SoundtrackUuid)
|
||||
|
||||
all, err := stats.AllSoundtracks(ctx)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, all)
|
||||
for i := 1; i < len(all); i++ {
|
||||
assert.LessOrEqual(t, all[i-1].SoundtrackName, all[i].SoundtrackName, "sorted by name")
|
||||
}
|
||||
for _, st := range all {
|
||||
if st.SoundtrackUuid == bird.Uuid {
|
||||
assert.Equal(t, int32(1), st.SoundtrackPlayed)
|
||||
assert.Len(t, st.Songs, 6)
|
||||
}
|
||||
if st.SoundtrackName == "Empty Soundtrack" {
|
||||
assert.Empty(t, st.Songs, "a soundtrack without songs has an empty song list")
|
||||
}
|
||||
}
|
||||
|
||||
never, err := stats.NeverPlayedSoundtracks(ctx)
|
||||
require.NoError(t, err)
|
||||
for _, st := range never {
|
||||
|
||||
Reference in new issue
Block a user