From 0c9d5df30b5b4ca49d36d82da536d28ca8ee243e Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 20 Jul 2020 15:18:37 +0100 Subject: [PATCH] not displaying hidden lb positions --- public/index.html | 22 +++++++++++----------- public/js/leaderboards.js | 14 ++++++++++---- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/public/index.html b/public/index.html index ae7d136c6..f6f62bbb7 100644 --- a/public/index.html +++ b/public/index.html @@ -7,7 +7,7 @@ Monkey Type - + @@ -1353,17 +1353,17 @@ - + - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/public/js/leaderboards.js b/public/js/leaderboards.js index cd34a3634..d4dbcee9a 100644 --- a/public/js/leaderboards.js +++ b/public/js/leaderboards.js @@ -134,14 +134,16 @@ function updateLeaderboards() { `); //daily $("#leaderboardsWrapper table.daily tbody").empty(); + let dindex = 0; if (dailyData.board !== undefined) { - dailyData.board.forEach((entry, index) => { + dailyData.board.forEach((entry) => { + if (entry.hidden) return; let meClassString = ""; if (entry.currentUser) { meClassString = ' class="me"'; $("#leaderboardsWrapper table.daily tfoot").html(` - ${index + 1} + ${dindex + 1} You ${entry.wpm} ${entry.raw} @@ -154,7 +156,7 @@ function updateLeaderboards() { $("#leaderboardsWrapper table.daily tbody").append(` ${ - index === 0 ? '' : index + 1 + dindex === 0 ? '' : dindex + 1 } ${entry.name} ${entry.wpm} @@ -164,6 +166,7 @@ function updateLeaderboards() { ${moment(entry.timestamp).format("DD MMM YYYY
HH:mm")} `); + dindex++; }); } let lenDaily = 0; @@ -197,8 +200,10 @@ function updateLeaderboards() { `); //global $("#leaderboardsWrapper table.global tbody").empty(); + let index = 0; if (globalData.board !== undefined) { - globalData.board.forEach((entry, index) => { + globalData.board.forEach((entry) => { + if (entry.hidden) return; let meClassString = ""; if (entry.currentUser) { meClassString = ' class="me"'; @@ -227,6 +232,7 @@ function updateLeaderboards() { ${moment(entry.timestamp).format("DD MMM YYYY
HH:mm")} `); + index++; }); } let lenGlobal = 0;