up labourage nouvelle ville
This commit is contained in:
parent
cc6c991090
commit
c0a1780fce
4 changed files with 44 additions and 31 deletions
|
@ -179,4 +179,8 @@ table tbody {
|
|||
overflow: auto;
|
||||
display: block;
|
||||
border: solid 3px rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
#citySuggestions{
|
||||
z-index: 10;
|
||||
}
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -458,11 +458,13 @@ class PublicController extends AbstractController
|
|||
|
||||
$stats = $place->getStats();
|
||||
if (!$stats) {
|
||||
$stats = $this->entityManager->getRepository(Stats::class)->findOneBy(['zone' => $place->getZipCode()]);
|
||||
}
|
||||
if (!$stats) {
|
||||
$stats = new Stats();
|
||||
$stats->setZone($place->getZipCode());
|
||||
$stats_exist = $this->entityManager->getRepository(Stats::class)->findOneBy(['zone' => $place->getZipCode()]);
|
||||
if ($stats_exist) {
|
||||
$stats = $stats_exist;
|
||||
} else {
|
||||
$stats = new Stats();
|
||||
$stats->setZone($place->getZipCode());
|
||||
}
|
||||
}
|
||||
|
||||
$stats->addPlace($place);
|
||||
|
|
|
@ -86,16 +86,19 @@ class FollowUpService
|
|||
|
||||
foreach ($types as $type => $data) {
|
||||
// Suivi du nombre
|
||||
$followupCount = new CityFollowUp();
|
||||
$followupCount->setName($type . '_count')
|
||||
->setMeasure($type === 'places' ? $stats->getPlacesCount() : count($data['objects']))
|
||||
->setDate($now)
|
||||
->setStats($stats);
|
||||
$em->persist($followupCount);
|
||||
$persisted++;
|
||||
if ($persisted % 100 === 0) {
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
$measureCount = $type === 'places' ? $stats->getPlacesCount() : count($data['objects']);
|
||||
if ($measureCount !== null) {
|
||||
$followupCount = new CityFollowUp();
|
||||
$followupCount->setName($type . '_count')
|
||||
->setMeasure($measureCount)
|
||||
->setDate($now)
|
||||
->setStats($stats);
|
||||
$em->persist($followupCount);
|
||||
$persisted++;
|
||||
if ($persisted % 100 === 0) {
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Suivi de la complétion basé sur les tags attendus
|
||||
|
@ -139,16 +142,18 @@ class FollowUpService
|
|||
} else {
|
||||
$completion = count($partialCompletions) > 0 ? round(array_sum($partialCompletions) / count($partialCompletions) * 100) : 0;
|
||||
}
|
||||
$followupCompletion = new CityFollowUp();
|
||||
$followupCompletion->setName($type . '_completion')
|
||||
->setMeasure($completion)
|
||||
->setDate($now)
|
||||
->setStats($stats);
|
||||
$em->persist($followupCompletion);
|
||||
$persisted++;
|
||||
if ($persisted % 100 === 0) {
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
if ($completion !== null) {
|
||||
$followupCompletion = new CityFollowUp();
|
||||
$followupCompletion->setName($type . '_completion')
|
||||
->setMeasure($completion)
|
||||
->setDate($now)
|
||||
->setStats($stats);
|
||||
$em->persist($followupCompletion);
|
||||
$persisted++;
|
||||
if ($persisted % 100 === 0) {
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
$em->flush();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue