Verified Commit b9f4ea25 authored by Daniel Sonck's avatar Daniel Sonck
Browse files

Fix returned item count algorithm

parent b8514ef9
Pipeline #435 waiting for manual action with stages
in 4 minutes and 4 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 && count < first; item = item.Next() {
for item = playlist.Start(); item != nil && first > 1; item = item.Next() {
if count > start {
result = append(result, model.PlaylistEdge{
Cursor: model.MakeCursor("PlaylistItem", count),
......@@ -38,6 +38,7 @@ func (r *queryResolver) Playlist(ctx context.Context, first int, after *model.Cu
})
}
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