fix: Suppression données fictives dans gestion.xhtml
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
This commit is contained in:
@@ -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) {
|
||||
@@ -816,6 +837,8 @@ public class EvenementsBean implements Serializable {
|
||||
private int participantsTotal;
|
||||
private String budgetTotal;
|
||||
private int moyenneParticipants;
|
||||
private int evenementsCeMois;
|
||||
private int tauxParticipationMoyen;
|
||||
|
||||
// Getters et setters
|
||||
public int getTotalEvenements() { return totalEvenements; }
|
||||
@@ -842,5 +865,15 @@ public class EvenementsBean implements Serializable {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<div class="text-900 font-bold text-2xl mb-2">#{evenementsBean.statistiques.totalEvenements}</div>
|
||||
<div class="flex align-items-center">
|
||||
<i class="pi pi-arrow-up text-green-500 text-sm mr-1"></i>
|
||||
<span class="text-green-600 font-semibold text-sm mr-2">+5</span>
|
||||
<span class="text-green-600 font-semibold text-sm mr-2">+#{evenementsBean.statistiques.evenementsCeMois}</span>
|
||||
<span class="text-500 text-xs">ce mois</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -79,11 +79,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-900 font-bold text-2xl mb-2">#{evenementsBean.statistiques.evenementsActifs}</div>
|
||||
<p:progressBar value="85"
|
||||
<p:progressBar value="#{evenementsBean.statistiques.tauxParticipationMoyen}"
|
||||
showValue="false"
|
||||
styleClass="surface-200 mt-2"
|
||||
style="height: 0.5rem;" />
|
||||
<div class="text-500 text-xs mt-2">85% de participation</div>
|
||||
<div class="text-500 text-xs mt-2">#{evenementsBean.statistiques.tauxParticipationMoyen}% de participation</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user