Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listLeaderboardRecordsAroundOwner does not return records for a single user. #122

Open
trey-a-hope opened this issue Jan 15, 2025 · 1 comment
Assignees
Labels
type: bug Something isn't working

Comments

@trey-a-hope
Copy link

Good evening,

I noticed that when I make a call to listLeaderboardRecordsAroundOwner, for some reason, all the leaderboard records are returned. For example, I have these two records in the leaderboard right now.
Screenshot 2025-01-15 at 1 15 10 AM
Here is my code. I am using owner id "d95808c5-a194-4e73-af8d-f07ed58f8253". However, as you can see, two records are returned.
Screenshot 2025-01-15 at 1 16 37 AM

Currently using nakama: ^1.2.0

Has anyone seen this error?

@ilmalte
Copy link
Collaborator

ilmalte commented Feb 20, 2025

Ciao @trey-a-hope!

The method listLeaderboardRecordsAroundOwner retrieves leaderboard records around a given ownerId, allowing navigation up or down using a cursor (which then works similarly to invoking listLeaderboardRecords with a cursor).

For example, if your leaderboard contains 100 records and you set ownerId = "player123" with limit = 5, the result will include the specified user along with nearby records:

{
  "records": [
    { "ownerId": "player120", "rank": 48, "score": 1500 },
    { "ownerId": "player121", "rank": 49, "score": 1480 },
    { "ownerId": "player123", "rank": 50, "score": 1450 },  // Your ownerId
    { "ownerId": "player125", "rank": 51, "score": 1430 },
    { "ownerId": "player127", "rank": 52, "score": 1400 }
  ]
}

This means the method does not return only the user's record, if that’s what you were expecting.

I agree that the method’s description might be misleading—it’s autogenerated from Nakama's proto and Swagger specifications. I’ve already submitted a PR to propose a clearer summary.

By the way, if you want to retrieve just the user's record, you can use listLeaderboardRecords and pass ownerId directly.

Please let me know if my understanding is correct and if this resolves the issue.

In the coming days, I'll review the other issues you've opened. Thanks for your patience!😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants