Fix pagination

This commit is contained in:
Hamcha 2018-09-18 10:31:02 +02:00
parent 3b0a84e36c
commit 6f4a7e7b66
Signed by: hamcha
GPG key ID: A40413D21021EAEE

View file

@ -66,6 +66,10 @@ func scryfallSearch(query string, offset int) (results CardSearchResults, err er
defer response.Body.Close()
err = json.NewDecoder(response.Body).Decode(&results)
results.Data = results.Data[cardoffset:]
maxoffset := cardoffset + 50
if maxoffset > len(results.Data) {
maxoffset = len(results.Data)
}
results.Data = results.Data[cardoffset:maxoffset]
return
}