i created a leaderboard on the server to reset every 10 minuets
let authoritative = false;
let sort = nkruntime.SortOrder.DESCENDING;
let operator = nkruntime.Operator.INCREMENTAL;
let reset = '*/10 * * * *';
try {
nk.leaderboardCreate("id", authoritative, sort, operator, reset);
logger.info("leadereboard initialized");
} catch (error) {
logger.error("error on initialize leaderboards, %s", error);
}
submitting score & reset function of leaderboard working without any issue, but when a leaderboard time period ends and leaderboard reset, i can’t get pervious record, i want to get the records before the last reset, so i try to fetch records like this
var result = await client.ListLeaderboardRecordsAsync(session, "id", null, 600, 100);
i tried in .net unity and js and tried to use any number instead 600 but result always is empty.
by the way getting current records (with null or 0 expiry) is working correctly.
Server version: 3.17.1+258a7f35
Unity client version: 3.9.0
The expiryTime that you pass in ListLeaderboardRecordsAsync needs to be the unix epoch of the reset time in question, you can obtain it in leaderboard listing or in the Nakama Console.
Thanks for your response @sesposito,
passing unix timestamp as expiryTime fixed issue and now i can get past records. the problem is finding that unix timestamp, for now im getting it from console where showing Prev-Next Reset, but i couldn’t find any way to obtain it from listing leaderboard as you said.
is there any way to get it in client, except calculating? (as it’s weird and i only do it if i has to)
The leaderboard listing results should contain the prev and next resets for the given leaderboard, if you’ll need to store beyond that it’s best if you keep the past expiryTimes in a storage object so that you can list them.
i checked documentation, API documentation and server codes on github.
on the client, leaderboard listing only return NextCursor & PrevCursor and not reset timers.
for now, as you said, best approach is saving nextReset on reset leaderboard function in a storage object and getting that before calling last leaderboard.
I am grateful for your support.
Is it possible you’re using an older Nakama Unity SDK release? I think the fields should be there on the most recent, but if not please let us know and we’ll make sure we add them into the next one.