List leaderboard records around owner (server side)

Hi there!
Is there an easy way to list the leaderboards records around a player, on the server side?
I can get the owner rank and then iterate using the cursor, but accessing the database 100 by 100 until get the interval looks like heavy work (maybe I’m wrong)

Here is a client side example, but seems like that feature is missing on server code.

Kind regards

Okay no I’m starting to feel a little lost here. Let’s say I have a leaderboard called “global”, execute this instruction:

entries, ownerEntries, previous, next, error := nk.LeaderboardRecordsList(ctx, "global", []string{playerID}, 100, "", 0)

Returns me the first 100 entries in “entries” (where the player is in 7th place, for example) and the player entry in “ownerEntries”. The player rank in “entries” is different than the player rank in “ownerEntries”.

Is this a bug? Am I missing something?

There’s currently no function exposed in the runtime to list a page of leaderboard records around an owner ID. You can open an issue on the tracker and we’ll add it to the list of requests to be addressed as soon as we can.

I’m not sure I’ve seen a case so far of a rank discrepancy like that. Can you create a separate issue for it with a reproducible case? Ideally a self-contained Lua module that creates a leaderboard, fills it with records, and performs the listing that shows this discrepancy. It’s possible the calculation is off in some case and it would help to have a reproducible test case.

Issue added.
Seems like that if you set some score, and this score is the same than other entries on the leaderboard. Leads to discrepancies between your real position (“entries”) and the one returned by “ownerEntries”
entries, ownerEntries, previous, next, error := nk.LeaderboardRecordsList(ctx, "global", []string{playerID}, 100, "", 0)

1 Like

We’ll continue the discussion on the issue on GitHub as needed, thanks for raising this!