ajout thème rnb

This commit is contained in:
Tykayn 2025-07-15 21:22:02 +02:00 committed by tykayn
parent 3d767ffaae
commit aae37c6ce0
9 changed files with 119 additions and 26 deletions

View file

@ -71,7 +71,7 @@ class FollowUpService
} elseif ($type === 'manhole') {
$objects = array_filter($elements, fn($el) => ($el['tags']['manhole'] ?? null) === 'manhole') ?? [];
} elseif ($type === 'little_free_library') {
$objects = array_filter($elements, fn($el) => ($el['tags']['amenity'] ?? null) === 'little_free_library') ?? [];
$objects = array_filter($elements, fn($el) => ($el['tags']['amenity'] ?? null) === 'public_bookcase') ?? [];
} elseif ($type === 'playground') {
$objects = array_filter($elements, fn($el) => ($el['tags']['leisure'] ?? null) === 'playground') ?? [];
} else {
@ -160,13 +160,23 @@ class FollowUpService
public function generateGlobalFollowUps(EntityManagerInterface $em): void
{
// Vérifier l'existence d'un objet Stats pour la zone '00000'
$statsGlobal = $em->getRepository(\App\Entity\Stats::class)->findOneBy(['zone' => '00000']);
if (!$statsGlobal) {
$statsGlobal = new \App\Entity\Stats();
$statsGlobal->setZone('00000');
$statsGlobal->setName('toutes les villes');
$em->persist($statsGlobal);
$em->flush();
if ($statsGlobal) {
// Si déjà existant, on le réutilise
// (optionnel : mettre à jour le nom si besoin)
if ($statsGlobal->getName() !== 'toutes les villes') {
$statsGlobal->setName('toutes les villes');
$em->persist($statsGlobal);
$em->flush();
}
} else {
// Sinon, on le crée
// $statsGlobal = new \App\Entity\Stats();
// $statsGlobal->setZone('00000');
// $statsGlobal->setName('toutes les villes');
// $em->persist($statsGlobal);
// $em->flush();
}
$now = new \DateTime();
$themes = array_keys(self::getFollowUpThemes());
@ -262,6 +272,7 @@ class FollowUpService
'bicycle_parking' => 'Parkings vélos',
'advertising_board' => 'Panneaux électoraux',
'building' => 'Bâtiments',
'rnb' => 'RNB',
'email' => 'Objets avec email',
'bench' => 'Bancs',
'waste_basket' => 'Poubelles',
@ -294,6 +305,7 @@ class FollowUpService
'bicycle_parking' => 'bi-bicycle',
'advertising_board' => 'bi-easel',
'building' => 'bi-building',
'rnb' => 'bi-key',
'email' => 'bi-envelope-at',
'bench' => 'bi-badge-wc',
'waste_basket' => 'bi-trash',
@ -332,6 +344,7 @@ class FollowUpService
'bicycle_parking' => 'nwr["amenity"="bicycle_parking"](area.searchArea);',
'advertising_board' => 'nwr["advertising"="board"]["message"="political"](area.searchArea);',
'building' => 'nwr["building"](area.searchArea);',
'rnb' => 'nwr["ref:FR:RNB"](area.searchArea);',
'email' => 'nwr["email"](area.searchArea);nwr["contact:email"](area.searchArea);',
'bench' => 'nwr["amenity"="bench"](area.searchArea);',
'waste_basket' => 'nwr["amenity"="waste_basket"](area.searchArea);',
@ -340,7 +353,7 @@ class FollowUpService
'tree' => 'nwr["natural"="tree"](area.searchArea);',
'power_pole' => 'nwr["power"="pole"](area.searchArea);',
'manhole' => 'nwr["manhole"](area.searchArea);',
'little_free_library' => 'nwr["amenity"="little_free_library"](area.searchArea);',
'little_free_library' => 'nwr["amenity"="public_bookcase"](area.searchArea);',
'playground' => 'nwr["leisure"="playground"](area.searchArea);',
];
}
@ -479,7 +492,8 @@ class FollowUpService
'healthcare' => ['name', 'contact:phone', 'phone', 'email', 'contact:email'],
'bicycle_parking' => ['capacity', 'covered'],
'advertising_board' => ['operator', 'contact:phone'],
'building' => ['name', 'ref'],
'building' => ['building'],
'rnb' => ['building', 'ref:FR:RNB'],
'email' => ['name', 'phone'],
'bench' => ['material', 'backrest'],
'waste_basket' => ['waste', 'recycling_type'],