Browse Source

limit high scores to 100

pull/8/head
Tim Glasgow 2 years ago
parent
commit
3c81d81fd4
  1. 4
      squarenotsquare/src/realm/repos/ScoreRepo.js

4
squarenotsquare/src/realm/repos/ScoreRepo.js

@ -28,7 +28,11 @@ export default class ScoreRepo {
getHighScores = () => {
let score = this.realmDB.objects(ScoreEntity.name).sorted('value', true);
let highScores = [];
let i = 0;
score.forEach((row) => {
if (i > 99){
return highScores;
}
highScores.push({user: row.user, value: row.value});
});
return highScores;

Loading…
Cancel
Save