Skip to content

Commit 5eba32c

Browse files
author
Kaizen Conroy
committed
remove players with no games from leaderboard
1 parent ae78a7e commit 5eba32c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: app.js

+6
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ app.get('/leaderboard', async (req, res)=>{
9595
* @param {{}} leaderboard Every player in the leaderboard.
9696
*/
9797
function processLeaderData(leaderboard){
98+
// remove players who have not played a game.
99+
leaderboard = leaderboard.filter(function (l) {
100+
return l.games > 0;
101+
})
102+
103+
// add percentage data.
98104
leaderboard.forEach(l => {
99105
// Encrypt id
100106
info = l._id.split("_");

0 commit comments

Comments
 (0)