ajout de followup sur plusieurs thèmes

This commit is contained in:
Tykayn 2025-06-29 16:41:18 +02:00 committed by tykayn
parent ab1b9a9d3d
commit 0cdb2f9ae9
6 changed files with 501 additions and 120 deletions

View file

@ -374,6 +374,49 @@ final class AdminController extends AbstractController
return ($b['completion_pondere_normalisee'] ?? 0) <=> ($a['completion_pondere_normalisee'] ?? 0);
});
// Récupérer les derniers followups pour chaque type
$latestFollowups = [];
$types = [
'fire_hydrant', 'charging_station', 'toilets', 'bus_stop', 'defibrillator', 'camera', 'recycling', 'substation', 'places'
];
foreach ($types as $type) {
$count = null;
$completion = null;
foreach ($stats->getCityFollowUps() as $fu) {
if ($fu->getName() === $type . '_count') {
if ($count === null || $fu->getDate() > $count->getDate()) {
$count = $fu;
}
}
if ($fu->getName() === $type . '_completion') {
if ($completion === null || $fu->getDate() > $completion->getDate()) {
$completion = $fu;
}
}
}
$latestFollowups[$type] = [];
if ($count) $latestFollowups[$type]['count'] = $count;
if ($completion) $latestFollowups[$type]['completion'] = $completion;
}
// Pour les lieux (places_count et places_completion)
$count = null;
$completion = null;
foreach ($stats->getCityFollowUps() as $fu) {
if ($fu->getName() === 'places_count') {
if ($count === null || $fu->getDate() > $count->getDate()) {
$count = $fu;
}
}
if ($fu->getName() === 'places_completion') {
if ($completion === null || $fu->getDate() > $completion->getDate()) {
$completion = $fu;
}
}
}
$latestFollowups['places'] = [];
if ($count) $latestFollowups['places']['count'] = $count;
if ($completion) $latestFollowups['places']['completion'] = $completion;
return $this->render('admin/stats.html.twig', [
'stats' => $stats,
'commerces' => $commerces,
@ -384,7 +427,8 @@ final class AdminController extends AbstractController
'statsHistory' => $statsHistory,
'CTC_urls' => $urls,
'overpass' => '',
'podium_local' => $podium_local
'podium_local' => $podium_local,
'latestFollowups' => $latestFollowups
]);
}