From 44b4f492894d6c8d1e79587b6db81eccc70c16f3 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Sat, 5 Jul 2025 17:47:00 +0200 Subject: [PATCH] command remove zero followups --- src/Command/DeleteZeroCityFollowUpCommand.php | 38 +++++++++++++++++++ src/Controller/AdminController.php | 19 ++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/Command/DeleteZeroCityFollowUpCommand.php diff --git a/src/Command/DeleteZeroCityFollowUpCommand.php b/src/Command/DeleteZeroCityFollowUpCommand.php new file mode 100644 index 0000000..25c2bed --- /dev/null +++ b/src/Command/DeleteZeroCityFollowUpCommand.php @@ -0,0 +1,38 @@ +em->getRepository(CityFollowUp::class); + $toDelete = $repo->createQueryBuilder('c') + ->where('c.measure = 0') + ->getQuery() + ->getResult(); + $count = count($toDelete); + foreach ($toDelete as $entity) { + $this->em->remove($entity); + } + $this->em->flush(); + $output->writeln("$count CityFollowUp supprimés (mesure = 0)"); + return Command::SUCCESS; + } +} \ No newline at end of file diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 459e039..91439ba 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -540,6 +540,16 @@ final class AdminController extends AbstractController return [null, null]; }; list($tagKey, $tagValue) = $extractTag($themeQueries[$theme] ?? ''); + // DEBUG : journaliser les main_tag et le filtrage + $all_main_tags = array_map(fn($p) => $p->getMainTag(), $places); + $debug_info = [ + 'theme' => $theme, + 'tagKey' => $tagKey, + 'tagValue' => $tagValue, + 'main_tags' => $all_main_tags, + 'places_count' => count($places), + ]; + $debug_filtered = []; foreach ($places as $place) { $match = false; $main_tag = $place->getMainTag(); @@ -577,8 +587,16 @@ final class AdminController extends AbstractController 'uuid' => $place->getUuidForUrl(), 'zip_code' => $place->getZipCode(), ]; + $debug_filtered[] = $main_tag; } } + $debug_info['filtered_count'] = count($objects); + $debug_info['filtered_main_tags'] = $debug_filtered; + if (property_exists($this, 'actionLogger') && $this->actionLogger) { + $this->actionLogger->log('[DEBUG][followupThemeGraph]', $debug_info); + } else { + error_log('[DEBUG][followupThemeGraph] ' . json_encode($debug_info)); + } $geojson = [ 'type' => 'FeatureCollection', 'features' => array_map(function ($obj) { @@ -617,6 +635,7 @@ final class AdminController extends AbstractController 'center' => $center, 'maptiler_token' => $_ENV['MAPTILER_TOKEN'] ?? null, 'completion_tags' => \App\Service\FollowUpService::getFollowUpCompletionTags(), + 'debug_info' => $debug_info, ]); }