diff --git a/src/Controller/FollowUpController.php b/src/Controller/FollowUpController.php
index 13f0ae1e..a36ee124 100644
--- a/src/Controller/FollowUpController.php
+++ b/src/Controller/FollowUpController.php
@@ -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(),
diff --git a/src/Service/FollowUpService.php b/src/Service/FollowUpService.php
index 8e50aea5..817c049c 100644
--- a/src/Service/FollowUpService.php
+++ b/src/Service/FollowUpService.php
@@ -183,20 +183,24 @@ class FollowUpService
});
} elseif ($type === 'tree') {
$completed = array_filter($data['objects'], function($el) {
- // Complet si le tag "species" ou "ref" est présent
- return !empty($el['tags']['species'] ?? null) || !empty($el['tags']['ref'] ?? null);
+ $tags = $el['tags'] ?? [];
+ $hasTaxonomy = !empty($tags['species'] ?? null)
+ || !empty($tags['genus'] ?? null)
+ || !empty($tags['taxon'] ?? null)
+ || !empty($tags['taxon:binomial'] ?? null);
+ $hasLeaf = !empty($tags['leaf_type'] ?? null)
+ || !empty($tags['leaf_cycle'] ?? null)
+ || !empty($tags['leaf_shape'] ?? null)
+ || !empty($tags['leaf_color'] ?? null)
+ || !empty($tags['leaf_fall'] ?? null);
+ return $hasTaxonomy && $hasLeaf;
});
}
- if ($type === 'lieux') {
- // Si le type est "lieux", on utilise la méthode completionPercent() de $stats
- if (method_exists($stats, 'getCompletionPercent')) {
- $completion = $stats->getCompletionPercent();
- } else {
- $completion = 0;
- }
+ if ($type === 'places') {
+ $completion = $stats->getCompletionPercent();
+ } else {
+ $completion = count($data['objects']) > 0 ? round(count($completed) / count($data['objects']) * 100) : 0;
}
-
- $completion = count($data['objects']) > 0 ? round(count($completed) / count($data['objects']) * 100) : 0;
$followupCompletion = new CityFollowUp();
$followupCompletion->setName($type . '_completion')
->setMeasure($completion)
diff --git a/templates/admin/followup_embed_graph.html.twig b/templates/admin/followup_embed_graph.html.twig
index 66ba8a48..7fb93096 100644
--- a/templates/admin/followup_embed_graph.html.twig
+++ b/templates/admin/followup_embed_graph.html.twig
@@ -21,6 +21,7 @@
{{ parent() }}
+