up historique

This commit is contained in:
Tykayn 2025-06-21 11:28:31 +02:00 committed by tykayn
parent ad4170db14
commit c274fd6a63
12 changed files with 448 additions and 616 deletions

View file

@ -173,17 +173,28 @@ class PublicController extends AbstractController
public function dashboard(): Response
{
$stats = $this->entityManager->getRepository(Stats::class)->findAll();
$stats_repo = $this->entityManager->getRepository(Stats::class)->findAll();
$stats_for_chart = [];
foreach ($stats_repo as $stat) {
if ($stat->getPlacesCount() > 0 && $stat->getName() !== null && $stat->getPopulation() > 0) {
$stats_for_chart[] = [
'name' => $stat->getName(),
'placesCount' => $stat->getPlacesCount(),
'completionPercent' => $stat->getCompletionPercent(),
'population' => $stat->getPopulation(),
];
}
}
// Compter le nombre total de lieux
$placesCount = $this->entityManager->getRepository(Place::class)->count([]);
return $this->render('public/dashboard.html.twig', [
'controller_name' => 'PublicController',
'mapbox_token' => $_ENV['MAPBOX_TOKEN'],
'maptiler_token' => $_ENV['MAPTILER_TOKEN'],
'stats' => $stats,
'mapbox_token' => $_ENV['MAPBOX_TOKEN'] ?? null,
'maptiler_token' => $_ENV['MAPTILER_TOKEN'] ?? null,
'stats' => json_encode($stats_for_chart),
'stats_list' => $stats_repo,
'places_count' => $placesCount,
]);
}