From b39849f745775814c1fd0d4288b38bc601c8c4d0 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Sat, 27 Dec 2025 23:21:32 -0500 Subject: [PATCH] Filter out scores for removed users in Scores tab (prevent Unknown user display) --- public/js/app_picks.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/public/js/app_picks.js b/public/js/app_picks.js index abfc4c9..50fdb38 100644 --- a/public/js/app_picks.js +++ b/public/js/app_picks.js @@ -484,7 +484,14 @@ const container = document.getElementById('scores-container'); if (!container) return; - if (scores.length === 0) { + // Filter out scores for removed users (Unknown users or null userId) + const validScores = scores.filter(score => + score.userName && + score.userName !== 'Unknown' && + score.userId + ); + + if (validScores.length === 0) { container.innerHTML = '
Aucun score disponible. Les utilisateurs doivent d\'abord soumettre leurs choix.
'; return; } @@ -503,7 +510,7 @@ - ${scores.map((score, index) => { + ${validScores.map((score, index) => { const percentage = totalCategories > 0 ? Math.round((score.score / totalCategories) * 100) : 0; const rank = index + 1; const medal = rank === 1 ? '🥇' : rank === 2 ? '🥈' : rank === 3 ? '🥉' : ''; @@ -527,14 +534,14 @@ `; - // Store scores data globally for modal access - window.scoresData = scores; + // Store valid scores data globally for modal access + window.scoresData = validScores; // Add event listeners for view picks buttons container.querySelectorAll('.view-picks-btn').forEach(btn => { btn.addEventListener('click', function() { const scoreIndex = parseInt(this.dataset.scoreIndex); - const score = scores[scoreIndex]; + const score = validScores[scoreIndex]; showUserPicksModal(score); }); });