up décompte de suivi des lieux et arbres

This commit is contained in:
Tykayn 2025-06-30 15:51:51 +02:00 committed by tykayn
parent 6c457986ad
commit 949dc71fb8
4 changed files with 65 additions and 23 deletions

View file

@ -86,13 +86,22 @@ class FollowUpController extends AbstractController
$followups = $followups->toArray();
usort($followups, fn($a, $b) => $a->getDate() <=> $b->getDate());
$series = [];
$all_points = [];
foreach ($followups as $fu) {
$series[$fu->getName()][] = [
'date' => $fu->getDate()->format('c'),
'value' => $fu->getMeasure(),
'name' => $fu->getName(),
];
$all_points[] = [
'date' => $fu->getDate()->format('c'),
'type' => $fu->getName(),
'name' => $fu->getName(),
'value' => $fu->getMeasure(),
];
}
usort($all_points, fn($a, $b) => strcmp($b['date'], $a['date']));
$all_points = array_slice($all_points, 0, 20);
// Tri par date dans chaque série
foreach ($series as &$points) {
usort($points, function($a, $b) {
@ -103,6 +112,7 @@ class FollowUpController extends AbstractController
return $this->render('admin/followup_graph.html.twig', [
'stats' => $stats,
'series' => $series,
'all_points' => $all_points,
'followup_labels' => FollowUpService::getFollowUpThemes(),
'followup_icons' => FollowUpService::getFollowUpIcons(),
'followup_overpass' => FollowUpService::getFollowUpOverpassQueries(),