Ajout du nombre de sièges dans le tableau

This commit is contained in:
Emmy D'Anello 2024-06-09 01:53:58 +02:00
parent 82b3f3a164
commit f413c8c130
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 8 additions and 3 deletions

View File

@ -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 <>
<TableContainer component={Paper}>
@ -29,16 +32,18 @@ function ResultatsTable({listes, resultats}) {
<TableCell>Voix</TableCell>
<TableCell>% Inscrites</TableCell>
<TableCell>% Exprimées</TableCell>
<TableCell>Sièges</TableCell>
</TableRow>
</TableHead>
<TableBody>
{listes.map((liste) => (
{listes_triees.map((liste) => (
<TableRow key={liste.numero}>
<TableCell>{liste.numero}</TableCell>
<TableCell>{liste.nom}</TableCell>
<TableCell>{voix_listes[liste.numero] || 0}</TableCell>
<TableCell>{(100 * (voix_listes[liste.numero] || 0) / resultats.exprimes).toFixed(2)} %</TableCell>
<TableCell>{(100 * (voix_listes[liste.numero] || 0) / resultats.inscrits).toFixed(2)} %</TableCell>
<TableCell>{siegesParListe[liste.numero]}</TableCell>
</TableRow>
))}
</TableBody>
@ -319,7 +324,7 @@ export default function Election2024({typeResultats = "france"}) {
highcharts={Highcharts}
options={compositonOptions}
/>
<ResultatsTable listes={listes} resultats={resultats} />
<ResultatsTable listes={listes} resultats={resultats} siegesParListe={siegesParListe} />
<ParticipationTable resultats={resultats} />
</>
};