diff --git a/dashboard/src/scenes/stats/Consultations.js b/dashboard/src/scenes/stats/Consultations.js index aa8a1dd50..a1158a7ee 100644 --- a/dashboard/src/scenes/stats/Consultations.js +++ b/dashboard/src/scenes/stats/Consultations.js @@ -17,40 +17,61 @@ const ConsultationsStats = ({ consultations, personsWithConsultations, filterBas return `Filtrer par personnes suivies (${personsWithConsultations} personnes concernées par le filtre actuel) :`; }, [filterPersons, personsWithConsultations]); + const consultationsByType = useMemo(() => { + const _consultationsByType = {}; + for (const consultationSetting of organisation.consultations) { + _consultationsByType[consultationSetting.name] = []; + } + for (const consultation of consultations) { + if (!_consultationsByType[consultation.type]) _consultationsByType[consultation.type] = []; + _consultationsByType[consultation.type].push(consultation); + } + return _consultationsByType; + }, [consultations, organisation.consultations]); + return ( <>