diff --git a/public/control.html b/public/control.html
index 5b2fbed..4705951 100644
--- a/public/control.html
+++ b/public/control.html
@@ -835,7 +835,7 @@
Gagnants actuels
-
La liste dépend de l’année sélectionnée.
+
Vue globale (toutes les années).
diff --git a/public/js/app_control.js b/public/js/app_control.js
index b5ade3a..4839be4 100644
--- a/public/js/app_control.js
+++ b/public/js/app_control.js
@@ -986,22 +986,10 @@ window.onload = async function () {
return winnersByYear.get(String(y)) || null;
}
- function renderWinnerCurrent() {
- if (!winnerCurrentEl || !winnerYearSelect) return;
- const y = parseYear(winnerYearSelect.value);
- if (!y) {
- winnerCurrentEl.textContent = '—';
- return;
- }
- const list = getWinnerForYear(y);
+ function sortWinnersForDisplay(list) {
const winners = Array.isArray(list) ? list : [];
- if (!winners.length) {
- winnerCurrentEl.textContent = `${y}: (aucun gagnant)`;
- return;
- }
-
// Sort for stable display: points desc (null last), then name
- const sorted = winners.slice().sort((a, b) => {
+ return winners.slice().sort((a, b) => {
const ap = a?.points === null || a?.points === undefined ? null : Number(a.points);
const bp = b?.points === null || b?.points === undefined ? null : Number(b.points);
if (ap === null && bp !== null) return 1;
@@ -1009,25 +997,57 @@ window.onload = async function () {
if (ap !== null && bp !== null && ap !== bp) return bp - ap;
return String(a?.name || '').localeCompare(String(b?.name || ''), 'fr', { sensitivity: 'base' });
});
+ }
- const rows = sorted.map((w) => {
- const name = w?.name || '(utilisateur supprimé)';
- const pts = w?.points === null || w?.points === undefined ? null : Number(w.points);
- const ptsLabel = pts === null || Number.isNaN(pts) ? '' : `
-
${name}${ptsLabel}
-
+
+
${escapeHtml(String(y))}${tieLabel}
+ ${rows}
`;
}).join('');
- const tieLabel = sorted.length > 1 ? '
(égalité)' : '';
- winnerCurrentEl.innerHTML = `
-
${y}${tieLabel}
- ${rows}
- `;
+ winnerCurrentEl.innerHTML = blocks;
winnerCurrentEl.querySelectorAll('button[data-winner-remove-year][data-winner-remove-user]').forEach((btn) => {
btn.addEventListener('click', async () => {