up labourage nouvelle ville

This commit is contained in:
Tykayn 2025-07-15 21:46:30 +02:00 committed by tykayn
parent cc6c991090
commit c0a1780fce
4 changed files with 44 additions and 31 deletions

View file

@ -743,8 +743,10 @@ final class AdminController extends AbstractController
}
$stats = $this->entityManager->getRepository(Stats::class)->findOneBy(['zone' => $insee_code]);
if (!$stats) {
$this->addFlash('error', '3 Aucune stats trouvée pour ce code INSEE.');
return $this->redirectToRoute('app_public_index');
$stats = new Stats();
$stats->setZone($insee_code);
// $this->addFlash('error', '3 Aucune stats trouvée pour ce code INSEE.');
// return $this->redirectToRoute('app_public_index');
}
// Mettre à jour la date de requête de labourage
$stats->setDateLabourageRequested(new \DateTime());
@ -771,10 +773,10 @@ final class AdminController extends AbstractController
$this->addFlash('warning', "Le serveur est trop sollicité actuellement (RAM insuffisante). La mise à jour des lieux sera effectuée plus tard automatiquement.");
}
// Toujours générer les CityFollowUp (mais ne jamais les supprimer)
$themes = \App\Service\FollowUpService::getFollowUpThemes();
foreach (array_keys($themes) as $theme) {
$this->followUpService->generateCityFollowUps($stats, $this->motocultrice, $this->entityManager, true, $theme);
}
// $themes = \App\Service\FollowUpService::getFollowUpThemes();
// foreach (array_keys($themes) as $theme) {
// $this->followUpService->generateCityFollowUps($stats, $this->motocultrice, $this->entityManager, true, $theme);
// }
$this->entityManager->flush();
return $this->redirectToRoute('app_admin_stats', ['insee_code' => $insee_code]);
}