up décompte lieux

This commit is contained in:
Tykayn 2025-06-29 20:02:51 +02:00 committed by tykayn
parent 4fbdcfc704
commit 4300278f15
2 changed files with 27 additions and 8 deletions

View file

@ -48,6 +48,8 @@ class FollowUpService
}) ?? [];
} elseif ($type === 'bicycle_parking') {
$objects = array_filter($elements, fn($el) => ($el['tags']['amenity'] ?? null) === 'bicycle_parking') ?? [];
} elseif ($type === 'places') {
$objects = [];
} else {
$objects = [];
}
@ -61,10 +63,12 @@ class FollowUpService
// Suivi du nombre
$followupCount = new CityFollowUp();
$followupCount->setName($type . '_count')
->setMeasure(count($data['objects']))
->setMeasure($type === 'places' ? $stats->getPlacesCount() : count($data['objects']))
->setDate($now)
->setStats($stats);
$em->persist($followupCount);
// Suivi de la complétion personnalisé (exemples)
$completed = [];
if ($type === 'fire_hydrant') {
@ -125,6 +129,15 @@ class FollowUpService
return !empty($el['tags']['capacity'] ?? null) || !empty($el['tags']['covered'] ?? null);
});
}
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;
}
}
$completion = count($data['objects']) > 0 ? round(count($completed) / count($data['objects']) * 100) : 0;
$followupCompletion = new CityFollowUp();
$followupCompletion->setName($type . '_completion')