From f413c8c130dc9b73dc25f8413ba9a8e66123c373 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 9 Jun 2024 01:53:58 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20nombre=20de=20si=C3=A8ges=20dans?= =?UTF-8?q?=20le=20tableau?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nupes-elections-front/src/Elections2024.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nupes-elections-front/src/Elections2024.js b/nupes-elections-front/src/Elections2024.js index f7d5d48..5a02418 100644 --- a/nupes-elections-front/src/Elections2024.js +++ b/nupes-elections-front/src/Elections2024.js @@ -16,8 +16,11 @@ import {useEffect, useState} from "react" highchartsItem(Highcharts) -function ResultatsTable({listes, resultats}) { +function ResultatsTable({listes, resultats, siegesParListe}) { const voix_listes = resultats.voix_listes + const listes_triees = listes.toSorted((l1, l2) => { + return (voix_listes[l2.numero] || 0) - (voix_listes[l1.numero] || 0) + }) return <> @@ -29,16 +32,18 @@ function ResultatsTable({listes, resultats}) { Voix % Inscrit⋅es % Exprimé⋅es + Sièges - {listes.map((liste) => ( + {listes_triees.map((liste) => ( {liste.numero} {liste.nom} {voix_listes[liste.numero] || 0} {(100 * (voix_listes[liste.numero] || 0) / resultats.exprimes).toFixed(2)} % {(100 * (voix_listes[liste.numero] || 0) / resultats.inscrits).toFixed(2)} % + {siegesParListe[liste.numero]} ))} @@ -319,7 +324,7 @@ export default function Election2024({typeResultats = "france"}) { highcharts={Highcharts} options={compositonOptions} /> - + }; \ No newline at end of file