Online Users of Leaderboard Service/Storage Service

0 votes

Hi,

My scenario is:

After getting list of live online users(getJoinedUsers() of Lobby), I need to get those users' score which is stored in Leaderboard Service. Additionally, I also use Storage Service to store users additional data.

---

My questions:

1. when I call leaderboardService.addJSONDoc. Does the JSONObject actually stored in Storage Service?

2. when I call below code, does it actually combine data of both Leaderboard and Storage Srtvice?

var build = queryBuilder.build("Key", "Value", Operator.EQUALS);         

scoreBoardService.setQuery(collectionName, build);

 

 

 

Regards;

 

closed with the note: Solved
asked Jan 12, 2015 in AppWarp by chamroeun (25 points)
closed Jan 13, 2015 by chamroeun

1 Answer

0 votes
 
Best answer

Hello,

 
To answer your query of finding the scores of all online users, it is directly not supported for your use case however you can find the leaderboard of all online users in chunk of 50 using Get Top N Rankers by Group method. Please have a at this link for  the code snippet.
 
Also find my answer in below lines for your other queries:
 
1. when I call leaderboardService.addJSONDoc. Does the JSONObject actually stored in Storage Service?
 
Ans: Yes, it store in Storage service which you can check as well by log-in into AppHQ Management Console (AppHQ Menu >> Technical Service >> Storage service). 

2. when I call below code, does it actually combine data of both Leaderboard and Storage Service?

var build = queryBuilder.build("Key", "Value", Operator.EQUALS);
scoreBoardService.setQuery(collectionName, build);

 
Ans: Yes it combined both data in one object. By setting the query in leaderboard service instance will return the JSON document along with leaderboard object. 
 
Let us know if it helps.  

Himanshu Sharma

answered Jan 12, 2015 by hs00105 (2,005 points)
selected Jan 13, 2015 by chamroeun
Thanks
I don't know your internal working regarding
var build = queryBuilder.build("Key", "Value", Operator.EQUALS);
scoreBoardService.setQuery(collectionName, build);
------
a. Should I just pass only collection(null query), which will retrieve the whole collection and  call Get Top N Rankers by Group by passing array of live users?

b. Or should I query only records I want in the scoreBoardService.setQuery?
To answer your both queries, if you want to fetch the desired result then you need to set the query else you can pass query parameter as null. It will retrieve all the information related to that user which exist in that collection along with leaderboard.
 
Let me know if it helps.
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...