Verified Commit 28511e13 authored by Daniel Sonck's avatar Daniel Sonck
Browse files

Fix returned item count algorithm again, only count when appending items

parent b9f4ea25
Pipeline #442 passed with stages
in 4 minutes and 13 seconds
......@@ -27,7 +27,7 @@ func (r *queryResolver) Playlist(ctx context.Context, first int, after *model.Cu
playlist := r.PlaylistProvider.Playlist()
count := 0
var item *playlist2.ListItem = nil
for item = playlist.Start(); item != nil && first > 1; item = item.Next() {
for item = playlist.Start(); item != nil && first > 0; item = item.Next() {
if count > start {
result = append(result, model.PlaylistEdge{
Cursor: model.MakeCursor("PlaylistItem", count),
......@@ -36,9 +36,9 @@ func (r *queryResolver) Playlist(ctx context.Context, first int, after *model.Cu
CueTrack: (*model.CueTrack)(&item.Song),
},
})
first--
}
count++
first--
}
return &model.PlaylistConnection{
ID: fmt.Sprintf("%d:%d", start+1, count-1),
......
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