From 0b0508958cfd26e78086183efb18f87bf340095b Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Fri, 28 Jun 2024 13:39:38 +0200 Subject: [PATCH] =?UTF-8?q?On=20affiche=20pas=20les=20r=C3=A9sultats=20du?= =?UTF-8?q?=20second=20tour=20s'il=20n'y=20en=20a=20pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/includes/composants_elections.js | 4 ++-- .../composants_elections_legislatives.js | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/nupes-elections-front/src/includes/composants_elections.js b/nupes-elections-front/src/includes/composants_elections.js index f5cebb9..11f31a0 100644 --- a/nupes-elections-front/src/includes/composants_elections.js +++ b/nupes-elections-front/src/includes/composants_elections.js @@ -118,7 +118,7 @@ export function CompositionHemicycle({titre, blocs, nuances, siegesParBloc, sieg */ export function TableauParticipation({donnees_t1, donnees_t2 = null}) { const headerRow = useMemo(() => { - if (donnees_t2) { + if (donnees_t2 && donnees_t2.inscrits) { return Nombre tour 1 @@ -140,7 +140,7 @@ export function TableauParticipation({donnees_t1, donnees_t2 = null}) { }, [donnees_t2]) const bodyRows = useMemo(() => { - if (donnees_t2) { + if (donnees_t2 && donnees_t2.inscrits) { return <> Inscrit⋅es diff --git a/nupes-elections-front/src/includes/composants_elections_legislatives.js b/nupes-elections-front/src/includes/composants_elections_legislatives.js index e014cd2..a4cafc6 100644 --- a/nupes-elections-front/src/includes/composants_elections_legislatives.js +++ b/nupes-elections-front/src/includes/composants_elections_legislatives.js @@ -12,6 +12,18 @@ export function TableauResultatsCandidatsLegislatives({blocs, candidats, nuances const voixCandidats_t2 = donnees_t2?.voix ?? {} const candidatsTriees = trierCandidats(candidats, voixCandidats_t1) + const cellules_t1 = <> + Voix tour 1 + % Inscrit⋅es tour 1 + % Exprimé⋅es tour 1 + + + const cellules_t2 = Math.max(...Object.values(voixCandidats_t2)) === 0 ? <> : <> + Voix tour 2 + % Inscrit⋅es tour 2 + % Exprimé⋅es tour 2 + + return <> @@ -21,12 +33,8 @@ export function TableauResultatsCandidatsLegislatives({blocs, candidats, nuances CandidatNuanceBloc - Voix tour 1 - % Inscrit⋅es tour 1 - % Exprimé⋅es tour 1 - Voix tour 2 - % Inscrit⋅es tour 2 - % Exprimé⋅es tour 2 + {cellules_t1} + {cellules_t2}