On affiche pas les résultats du second tour s'il n'y en a pas
This commit is contained in:
parent
d78ac420d8
commit
0b0508958c
|
@ -118,7 +118,7 @@ export function CompositionHemicycle({titre, blocs, nuances, siegesParBloc, sieg
|
||||||
*/
|
*/
|
||||||
export function TableauParticipation({donnees_t1, donnees_t2 = null}) {
|
export function TableauParticipation({donnees_t1, donnees_t2 = null}) {
|
||||||
const headerRow = useMemo(() => {
|
const headerRow = useMemo(() => {
|
||||||
if (donnees_t2) {
|
if (donnees_t2 && donnees_t2.inscrits) {
|
||||||
return <TableRow>
|
return <TableRow>
|
||||||
<TableCell></TableCell>
|
<TableCell></TableCell>
|
||||||
<TableCell>Nombre tour 1</TableCell>
|
<TableCell>Nombre tour 1</TableCell>
|
||||||
|
@ -140,7 +140,7 @@ export function TableauParticipation({donnees_t1, donnees_t2 = null}) {
|
||||||
}, [donnees_t2])
|
}, [donnees_t2])
|
||||||
|
|
||||||
const bodyRows = useMemo(() => {
|
const bodyRows = useMemo(() => {
|
||||||
if (donnees_t2) {
|
if (donnees_t2 && donnees_t2.inscrits) {
|
||||||
return <>
|
return <>
|
||||||
<TableRow key={"Inscrit⋅es"}>
|
<TableRow key={"Inscrit⋅es"}>
|
||||||
<TableCell>Inscrit⋅es</TableCell>
|
<TableCell>Inscrit⋅es</TableCell>
|
||||||
|
|
|
@ -12,6 +12,18 @@ export function TableauResultatsCandidatsLegislatives({blocs, candidats, nuances
|
||||||
const voixCandidats_t2 = donnees_t2?.voix ?? {}
|
const voixCandidats_t2 = donnees_t2?.voix ?? {}
|
||||||
const candidatsTriees = trierCandidats(candidats, voixCandidats_t1)
|
const candidatsTriees = trierCandidats(candidats, voixCandidats_t1)
|
||||||
|
|
||||||
|
const cellules_t1 = <>
|
||||||
|
<TableCell>Voix tour 1</TableCell>
|
||||||
|
<TableCell>% Inscrit⋅es tour 1</TableCell>
|
||||||
|
<TableCell>% Exprimé⋅es tour 1</TableCell>
|
||||||
|
</>
|
||||||
|
|
||||||
|
const cellules_t2 = Math.max(...Object.values(voixCandidats_t2)) === 0 ? <></> : <>
|
||||||
|
<TableCell>Voix tour 2</TableCell>
|
||||||
|
<TableCell>% Inscrit⋅es tour 2</TableCell>
|
||||||
|
<TableCell>% Exprimé⋅es tour 2</TableCell>
|
||||||
|
</>
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<TableContainer component={Paper}>
|
<TableContainer component={Paper}>
|
||||||
<Table sx={{ minWidth: 650 }} aria-label="simple table">
|
<Table sx={{ minWidth: 650 }} aria-label="simple table">
|
||||||
|
@ -21,12 +33,8 @@ export function TableauResultatsCandidatsLegislatives({blocs, candidats, nuances
|
||||||
<TableCell>Candidat</TableCell>
|
<TableCell>Candidat</TableCell>
|
||||||
<TableCell colSpan={2}>Nuance</TableCell>
|
<TableCell colSpan={2}>Nuance</TableCell>
|
||||||
<TableCell colSpan={2}>Bloc</TableCell>
|
<TableCell colSpan={2}>Bloc</TableCell>
|
||||||
<TableCell>Voix tour 1</TableCell>
|
{cellules_t1}
|
||||||
<TableCell>% Inscrit⋅es tour 1</TableCell>
|
{cellules_t2}
|
||||||
<TableCell>% Exprimé⋅es tour 1</TableCell>
|
|
||||||
<TableCell>Voix tour 2</TableCell>
|
|
||||||
<TableCell>% Inscrit⋅es tour 2</TableCell>
|
|
||||||
<TableCell>% Exprimé⋅es tour 2</TableCell>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
|
Loading…
Reference in New Issue