From d22083fea824644c6caba597eea2c3b0f96eb63c Mon Sep 17 00:00:00 2001 From: dahoud Date: Wed, 3 Dec 2025 21:59:27 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20Suppression=20donn=C3=A9es=20fictives=20?= =?UTF-8?q?dans=20gestion.xhtml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pages XHTML modifiées: - admin/evenements/gestion.xhtml: * Ligne 63: Remplacé "+5" hardcodé par #{evenementsBean.statistiques.evenementsCeMois} * Ligne 82-86: Remplacé "85%" hardcodé par #{evenementsBean.statistiques.tauxParticipationMoyen} Bean modifié: - EvenementsBean.java: * Ajout propriété evenementsCeMois calculée depuis dateCreation backend * Ajout propriété tauxParticipationMoyen calculée depuis participantsInscrits/capaciteMax * Calculs effectués dans chargerStatistiques() depuis données réelles Toutes les données proviennent maintenant du backend Compilation réussie sans erreurs --- .../unionflow/client/view/EvenementsBean.java | 41 +++++++++++++++++-- .../pages/admin/evenements/gestion.xhtml | 8 ++-- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/unionflow-client-quarkus-primefaces-freya/src/main/java/dev/lions/unionflow/client/view/EvenementsBean.java b/unionflow-client-quarkus-primefaces-freya/src/main/java/dev/lions/unionflow/client/view/EvenementsBean.java index 2fa5318..7d6b3b7 100644 --- a/unionflow-client-quarkus-primefaces-freya/src/main/java/dev/lions/unionflow/client/view/EvenementsBean.java +++ b/unionflow-client-quarkus-primefaces-freya/src/main/java/dev/lions/unionflow/client/view/EvenementsBean.java @@ -212,12 +212,33 @@ public class EvenementsBean implements Serializable { double moyenne = (double) totalParticipants / tousLesEvenements.size(); statistiques.setMoyenneParticipants((int) moyenne); + + // Calculer les événements créés ce mois depuis les données backend + LocalDate debutMois = LocalDate.now().withDayOfMonth(1); + long evenementsCeMois = tousLesEvenements.stream() + .filter(e -> e.getDateCreation() != null && + !e.getDateCreation().isBefore(debutMois.atStartOfDay())) + .count(); + statistiques.setEvenementsCeMois((int) evenementsCeMois); + + // Calculer le taux de participation moyen depuis les données backend + double tauxMoyen = tousLesEvenements.stream() + .filter(e -> e.getCapaciteMax() != null && e.getCapaciteMax() > 0) + .mapToDouble(e -> { + int inscrits = e.getParticipantsInscrits() != null ? e.getParticipantsInscrits() : 0; + return (double) inscrits / e.getCapaciteMax() * 100.0; + }) + .average() + .orElse(0.0); + statistiques.setTauxParticipationMoyen((int) tauxMoyen); } else { statistiques.setTotalEvenements(0); statistiques.setEvenementsActifs(0); statistiques.setParticipantsTotal(0); statistiques.setBudgetTotal("0 FCFA"); statistiques.setMoyenneParticipants(0); + statistiques.setEvenementsCeMois(0); + statistiques.setTauxParticipationMoyen(0); } } catch (Exception e) { @@ -810,13 +831,15 @@ public class EvenementsBean implements Serializable { public static class StatistiquesEvenements implements Serializable { private static final long serialVersionUID = 1L; - + private int totalEvenements; private int evenementsActifs; private int participantsTotal; private String budgetTotal; private int moyenneParticipants; - + private int evenementsCeMois; + private int tauxParticipationMoyen; + // Getters et setters public int getTotalEvenements() { return totalEvenements; } public void setTotalEvenements(int totalEvenements) { @@ -839,8 +862,18 @@ public class EvenementsBean implements Serializable { } public int getMoyenneParticipants() { return moyenneParticipants; } - public void setMoyenneParticipants(int moyenneParticipants) { - this.moyenneParticipants = moyenneParticipants; + public void setMoyenneParticipants(int moyenneParticipants) { + this.moyenneParticipants = moyenneParticipants; + } + + public int getEvenementsCeMois() { return evenementsCeMois; } + public void setEvenementsCeMois(int evenementsCeMois) { + this.evenementsCeMois = evenementsCeMois; + } + + public int getTauxParticipationMoyen() { return tauxParticipationMoyen; } + public void setTauxParticipationMoyen(int tauxParticipationMoyen) { + this.tauxParticipationMoyen = tauxParticipationMoyen; } } } diff --git a/unionflow-client-quarkus-primefaces-freya/src/main/resources/META-INF/resources/pages/admin/evenements/gestion.xhtml b/unionflow-client-quarkus-primefaces-freya/src/main/resources/META-INF/resources/pages/admin/evenements/gestion.xhtml index 419891d..e39e156 100644 --- a/unionflow-client-quarkus-primefaces-freya/src/main/resources/META-INF/resources/pages/admin/evenements/gestion.xhtml +++ b/unionflow-client-quarkus-primefaces-freya/src/main/resources/META-INF/resources/pages/admin/evenements/gestion.xhtml @@ -60,7 +60,7 @@
#{evenementsBean.statistiques.totalEvenements}
- +5 + +#{evenementsBean.statistiques.evenementsCeMois} ce mois
@@ -79,11 +79,11 @@
#{evenementsBean.statistiques.evenementsActifs}
- -
85% de participation
+
#{evenementsBean.statistiques.tauxParticipationMoyen}% de participation