To use Firebase rules to order your scores is beyond the capabilities of the built-in Firebase blocks in AI2.
You need to use the web component to call your subset of data > scores: Name: “score”, Name: “score”
and set rules in Firebase to order your data:
{
"rules": {
".read": true,
".write": true,
"scores": {
".indexOn": [".value"]
}
}
}
As I mentioned you will need a subset of data saved to firebase for this to work.
Under your main project bucket you need a child called “scores”, then you save to this the player name and their score (at the same time as you save then to the mathematiks child) so that you end up with:
scores
2 test: 400
3 test: 200
4 test: 500
You then use a GET request in AI2 web component to call back the data in scores
this example returns the top 50 scores, with highest first.
The other way is to call back all your data in mathematiks and work through the list/s generated and orgnaising and sorting to get your leaderboard