From 3c81d81fd4087b890dfcf26a4cf573bb03ff2b89 Mon Sep 17 00:00:00 2001 From: Tim Glasgow Date: Mon, 8 Aug 2022 17:43:15 -0500 Subject: [PATCH] limit high scores to 100 --- squarenotsquare/src/realm/repos/ScoreRepo.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/squarenotsquare/src/realm/repos/ScoreRepo.js b/squarenotsquare/src/realm/repos/ScoreRepo.js index e4a202e..5050c80 100644 --- a/squarenotsquare/src/realm/repos/ScoreRepo.js +++ b/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;