From 80991241a64fb6de75e5a197c3ce572259353b2f Mon Sep 17 00:00:00 2001 From: Chung Nguyen Thanh Date: Tue, 29 Oct 2024 22:15:46 +0700 Subject: [PATCH] Update updateLeaderboard.js --- .github/updateLeaderboard.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/updateLeaderboard.js b/.github/updateLeaderboard.js index cd09cb5..cb3d6ec 100644 --- a/.github/updateLeaderboard.js +++ b/.github/updateLeaderboard.js @@ -50,7 +50,9 @@ module.exports = async ({ github, context }) => { let recentPlaysContent = recentPlaysSection[0]; recentPlaysContent = recentPlaysContent.replace(//, `${newEntry}`); - const recentPlaysRows = recentPlaysContent.split('\n').filter(row => row.startsWith('|') && !row.includes('Score | Player | Message | Date')); + const recentPlaysRows = recentPlaysContent + .split('\n') + .filter(row => row.startsWith('|') && !row.includes('Score | Player | Message | Date') && !row.includes('|-------|--------|---------|------|')); if (recentPlaysRows.length > 20) recentPlaysRows.pop(); @@ -64,7 +66,9 @@ module.exports = async ({ github, context }) => { let leaderboardContent = leaderboardSection[0]; leaderboardContent = leaderboardContent.replace(//, `${newEntry}`); - const leaderboardRows = leaderboardContent.split('\n').filter(row => row.startsWith('|') && !row.includes('Score | Player | Message | Date')); + const leaderboardRows = leaderboardContent + .split('\n') + .filter(row => row.startsWith('|') && !row.includes('Score | Player | Message | Date') && !row.includes('|-------|--------|---------|------|')); leaderboardRows.sort((a, b) => { const scoreA = a.match(/^\| (\d+) \|/);