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