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();
|
double moyenne = (double) totalParticipants / tousLesEvenements.size();
|
||||||
statistiques.setMoyenneParticipants((int) moyenne);
|
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 {
|
} else {
|
||||||
statistiques.setTotalEvenements(0);
|
statistiques.setTotalEvenements(0);
|
||||||
statistiques.setEvenementsActifs(0);
|
statistiques.setEvenementsActifs(0);
|
||||||
statistiques.setParticipantsTotal(0);
|
statistiques.setParticipantsTotal(0);
|
||||||
statistiques.setBudgetTotal("0 FCFA");
|
statistiques.setBudgetTotal("0 FCFA");
|
||||||
statistiques.setMoyenneParticipants(0);
|
statistiques.setMoyenneParticipants(0);
|
||||||
|
statistiques.setEvenementsCeMois(0);
|
||||||
|
statistiques.setTauxParticipationMoyen(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -810,13 +831,15 @@ public class EvenementsBean implements Serializable {
|
|||||||
|
|
||||||
public static class StatistiquesEvenements implements Serializable {
|
public static class StatistiquesEvenements implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private int totalEvenements;
|
private int totalEvenements;
|
||||||
private int evenementsActifs;
|
private int evenementsActifs;
|
||||||
private int participantsTotal;
|
private int participantsTotal;
|
||||||
private String budgetTotal;
|
private String budgetTotal;
|
||||||
private int moyenneParticipants;
|
private int moyenneParticipants;
|
||||||
|
private int evenementsCeMois;
|
||||||
|
private int tauxParticipationMoyen;
|
||||||
|
|
||||||
// Getters et setters
|
// Getters et setters
|
||||||
public int getTotalEvenements() { return totalEvenements; }
|
public int getTotalEvenements() { return totalEvenements; }
|
||||||
public void setTotalEvenements(int totalEvenements) {
|
public void setTotalEvenements(int totalEvenements) {
|
||||||
@@ -839,8 +862,18 @@ public class EvenementsBean implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMoyenneParticipants() { return moyenneParticipants; }
|
public int getMoyenneParticipants() { return moyenneParticipants; }
|
||||||
public void setMoyenneParticipants(int moyenneParticipants) {
|
public void setMoyenneParticipants(int moyenneParticipants) {
|
||||||
this.moyenneParticipants = 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="text-900 font-bold text-2xl mb-2">#{evenementsBean.statistiques.totalEvenements}</div>
|
||||||
<div class="flex align-items-center">
|
<div class="flex align-items-center">
|
||||||
<i class="pi pi-arrow-up text-green-500 text-sm mr-1"></i>
|
<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>
|
<span class="text-500 text-xs">ce mois</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,11 +79,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-900 font-bold text-2xl mb-2">#{evenementsBean.statistiques.evenementsActifs}</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"
|
showValue="false"
|
||||||
styleClass="surface-200 mt-2"
|
styleClass="surface-200 mt-2"
|
||||||
style="height: 0.5rem;" />
|
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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user