LeaderboardDataRequest on an empty leaderboard returns INVALID error
C
Christian Gascons
started a topic
almost 6 years ago
Hi, just found out that, performing a LeaderbordDataRequest on an empty leaderboard will return an "INVALID" error. That's actually not an error, right? I'd suggest to return a response with its data empty, but not an error.
Thanks for looking into this,
Chris
Best Answer
C
Customer Support
said
almost 6 years ago
Hi Chris,
I just realized I've been dealing with Javier from your team on a Ticket on the same issue. Basically whats happening here is this, as your Leaderboard is set to "Reset Weekly" the Leaderboard will never exist as "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display", it will always have the ".SNAPSHOT" on the end, the date will be the beginning of the current week for a Reset Weekly Leaderboard. You will need to add this yourself on the client side when retrieving a leaderboard. You could also do a ListLeaderboardsRequest on the client side and get the shortCode from there. If you have any other questions just let me know.
No problem at all, I'll close Javiers ticket also if you guys have no further questions.
Thanks,
Liam
C
Christian Gascons
said
almost 6 years ago
Hi Liam,
Sorry about that! Didn't realize we were asking about the same issue.
All clear now, thanks!
Chris
Customer Support
said
almost 6 years ago
Answer
Hi Chris,
I just realized I've been dealing with Javier from your team on a Ticket on the same issue. Basically whats happening here is this, as your Leaderboard is set to "Reset Weekly" the Leaderboard will never exist as "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display", it will always have the ".SNAPSHOT" on the end, the date will be the beginning of the current week for a Reset Weekly Leaderboard. You will need to add this yourself on the client side when retrieving a leaderboard. You could also do a ListLeaderboardsRequest on the client side and get the shortCode from there. If you have any other questions just let me know.
Thanks,
Liam
C
Christian Gascons
said
almost 6 years ago
Hi again Liam,
Before continuing, let me add a little bit more information just in case. I've been checking the full configuration of the Leaderboard, and it looks like the problem is not entirely the fact that the LB is empty or not, but its configuration. The leaderboard's update schedule is "Reset Weekly", and it's being sorted by the Score read from an event which has 2 attributes: The Score, and a Day (which default value is ${today}, and its default Calc is Count).
With this configuration testing via Test Harness this call:
Notice that there's a suffix added (.SNAPSHOT.2016-05-08)
So, now that there's data is being returned, and if I call the event that is linked to this leaderboard from the test harness (this line of code):
//Retrieve the leaderboards scores
var weeklyMemberTotalLB = Spark.getLeaderboards().getLeaderboard("GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display").getEntriesFromPlayer(Spark.getPlayer().getPlayerId(), 1).next();
will return data, but if on the other hand, I call the event from my project, the variable 'weeklyMemberTotalLB' will be null instead. I just added some logs in order to test that and can confirm the issue.
Hope this extra info helps a little bit more.
Cheers,
C
Christian Gascons
said
almost 6 years ago
Hi Liam,
That's not quite possible, I just double checked and there are no typos in the name of the Leaderboard, I've got 26 on my game, I'd ask you if you are sure you are looking at the right game, but my account only holds 1 project right now, could you please make sure you are looking at the right place?
Thanks!
Customer Support
said
almost 6 years ago
Hi Chris,
I created a test user and had a look at your leaderboards, the "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display" doesn't appear at all in a ListLeaderBoardsRequest, I'm not quite sure why. My empty Leaderboards show up fine, I'll investigate this some more and get back to you.
Thanks,
Liam
C
Christian Gascons
said
almost 6 years ago
Please go ahead.
Thanks,
Chris
Customer Support
said
almost 6 years ago
Hi Chris,
Would you mind if I created a test user in your game to have a look at this a bit closer ?
Thanks,
Liam
C
Christian Gascons
said
almost 6 years ago
Hi Liam,
Thanks for such a quick response. The current request I was sending is this one:
Are you sure you are supplying a valid shortCode ? If I create a Leaderboard and perform a LeaderboardDataRequest on it with a valid shortCode I get the empty data response you are expecting.
I also get the same result after I have cleared my Leaderboard and Running Total of all entries. If you can let me know the shortCode you are using and the name of your game I'll take a look into this for you.
Christian Gascons
Hi, just found out that, performing a LeaderbordDataRequest on an empty leaderboard will return an "INVALID" error. That's actually not an error, right? I'd suggest to return a response with its data empty, but not an error.
Thanks for looking into this,
Chris
Hi Chris,
I just realized I've been dealing with Javier from your team on a Ticket on the same issue. Basically whats happening here is this, as your Leaderboard is set to "Reset Weekly" the Leaderboard will never exist as "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display", it will always have the ".SNAPSHOT" on the end, the date will be the beginning of the current week for a Reset Weekly Leaderboard. You will need to add this yourself on the client side when retrieving a leaderboard. You could also do a ListLeaderboardsRequest on the client side and get the shortCode from there. If you have any other questions just let me know.
Thanks,
Liam
- Oldest First
- Popular
- Newest First
Sorted by Newest FirstCustomer Support
Hi Chris,
No problem at all, I'll close Javiers ticket also if you guys have no further questions.
Thanks,
Liam
Christian Gascons
Hi Liam,
Sorry about that! Didn't realize we were asking about the same issue.
All clear now, thanks!
Chris
Customer Support
Hi Chris,
I just realized I've been dealing with Javier from your team on a Ticket on the same issue. Basically whats happening here is this, as your Leaderboard is set to "Reset Weekly" the Leaderboard will never exist as "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display", it will always have the ".SNAPSHOT" on the end, the date will be the beginning of the current week for a Reset Weekly Leaderboard. You will need to add this yourself on the client side when retrieving a leaderboard. You could also do a ListLeaderboardsRequest on the client side and get the shortCode from there. If you have any other questions just let me know.
Thanks,
Liam
Christian Gascons
Hi again Liam,
Before continuing, let me add a little bit more information just in case. I've been checking the full configuration of the Leaderboard, and it looks like the problem is not entirely the fact that the LB is empty or not, but its configuration. The leaderboard's update schedule is "Reset Weekly", and it's being sorted by the Score read from an event which has 2 attributes: The Score, and a Day (which default value is ${today}, and its default Calc is Count).
With this configuration testing via Test Harness this call:
{
"@class": ".LeaderboardDataRequest",
"entryCount": 1,
"leaderboardShortCode": "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display"
}
Returns this:
Notice that there's a suffix added (.SNAPSHOT.2016-05-08)
So, now that there's data is being returned, and if I call the event that is linked to this leaderboard from the test harness (this line of code):
will return data, but if on the other hand, I call the event from my project, the variable 'weeklyMemberTotalLB' will be null instead. I just added some logs in order to test that and can confirm the issue.
Hope this extra info helps a little bit more.
Cheers,
Christian Gascons
Hi Liam,
That's not quite possible, I just double checked and there are no typos in the name of the Leaderboard, I've got 26 on my game, I'd ask you if you are sure you are looking at the right game, but my account only holds 1 project right now, could you please make sure you are looking at the right place?
Thanks!
Customer Support
Hi Chris,
I created a test user and had a look at your leaderboards, the "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display" doesn't appear at all in a ListLeaderBoardsRequest, I'm not quite sure why. My empty Leaderboards show up fine, I'll investigate this some more and get back to you.
Thanks,
Liam
Christian Gascons
Please go ahead.
Thanks,
Chris
Customer Support
Hi Chris,
Would you mind if I created a test user in your game to have a look at this a bit closer ?
Thanks,
Liam
Christian Gascons
Hi Liam,
Thanks for such a quick response. The current request I was sending is this one:
{
"@class": ".LeaderboardDataRequest",
"entryCount": 5,
"leaderboardShortCode": "GUILD_WEEKLY_TOTAL_MEMBERS_LB_Display"
}
And the response I'm getting is:
Thanks Liam,
Chris
Customer Support
Hi Christian,
Are you sure you are supplying a valid shortCode ? If I create a Leaderboard and perform a LeaderboardDataRequest on it with a valid shortCode I get the empty data response you are expecting.
I also get the same result after I have cleared my Leaderboard and Running Total of all entries. If you can let me know the shortCode you are using and the name of your game I'll take a look into this for you.
Thanks,
Liam
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics