calcul progression

This commit is contained in:
Tykayn 2025-07-05 10:29:53 +02:00 committed by tykayn
parent 2bbc7153c6
commit c81affd3e3
8 changed files with 275 additions and 50 deletions

View file

@ -446,6 +446,13 @@ final class AdminController extends AbstractController
if ($count) $latestFollowups['places']['count'] = $count;
if ($completion) $latestFollowups['places']['completion'] = $completion;
// Calculer la progression sur 7 jours pour chaque type
$progression7Days = [];
foreach ($types as $type) {
$progression7Days[$type] = \App\Service\FollowUpService::calculate7DayProgression($stats, $type);
}
$progression7Days['places'] = \App\Service\FollowUpService::calculate7DayProgression($stats, 'places');
return $this->render('admin/stats.html.twig', [
'stats' => $stats,
'commerces' => $commerces,
@ -460,6 +467,7 @@ final class AdminController extends AbstractController
'latestFollowups' => $latestFollowups,
'followup_labels' => \App\Service\FollowUpService::getFollowUpThemes(),
'followup_icons' => \App\Service\FollowUpService::getFollowUpIcons(),
'progression7Days' => $progression7Days,
]);
}
@ -530,6 +538,7 @@ final class AdminController extends AbstractController
public function labourer(Request $request, string $insee_code, bool $updateExisting = true): Response
{
$deleteMissing = $request->query->getBoolean('deleteMissing', true);
$disableFollowUpCleanup = $request->query->getBoolean('disableFollowUpCleanup', false);
$this->actionLogger->log('labourer', ['insee_code' => $insee_code]);
@ -890,7 +899,7 @@ final class AdminController extends AbstractController
$this->entityManager->flush();
// Générer les suivis (followups) après la mise à jour des Places
$this->followUpService->generateCityFollowUps($stats, $this->motocultrice, $this->entityManager);
$this->followUpService->generateCityFollowUps($stats, $this->motocultrice, $this->entityManager, $disableFollowUpCleanup);
$message = 'Labourage terminé avec succès. ' . $processedCount . ' nouveaux lieux traités.';
if ($updateExisting) {