From 7d82a02397de0dc6bde43da013f8b9f4e8a65824 Mon Sep 17 00:00:00 2001 From: NOPepin Date: Wed, 11 Feb 2026 20:46:49 +0100 Subject: [PATCH 1/2] =?UTF-8?q?corrections-communes=20:=20correction=20fix?= =?UTF-8?q?tures=20communes=20et=20r=C3=A9cup=20taxes=20par=20d=C3=A9parte?= =?UTF-8?q?ment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/src/DataFixtures/AppFixtures.php | 16 +++++----------- api-platform/api/src/Entity/Taxe.php | 3 ++- .../api/src/State/AverageTaxStatsProvider.php | 1 + front/src/components/ScatterPlot.tsx | 3 +++ front/src/pages/Dashboard.tsx | 5 +++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/api-platform/api/src/DataFixtures/AppFixtures.php b/api-platform/api/src/DataFixtures/AppFixtures.php index 1cbb2c2..96e5733 100644 --- a/api-platform/api/src/DataFixtures/AppFixtures.php +++ b/api-platform/api/src/DataFixtures/AppFixtures.php @@ -210,6 +210,8 @@ class AppFixtures extends Fixture $tauxCFE = floatval(self::decoderExcelHex($data[$tauxCFECol - 1] ?? '')); $volCFE = floatval(self::decoderExcelHex($data[$volCFECol - 1] ?? '')); + $comNum = $comNum * 1000 + $depNum; + $args = [ $annee, $depNum, $depNom, $regNom, $comNum, $comNom, $tauxTFPNB, $volTFPNB, $tauxTFPB, $volTFPB, $tauxTH, $volTH, $tauxCFE, $volCFE @@ -217,9 +219,9 @@ class AppFixtures extends Fixture $departement = $departements[$depNum] ?? null; $commune = $communes[$comNum] ?? null; + $region = $regions[$regNom] ?? null; if(is_null($departement)) { - $region = $regions[$regNom] ?? null; if(is_null($region)) { $region = new Region(); @@ -246,19 +248,11 @@ class AppFixtures extends Fixture $commune->setDepartement($departement); $manager->persist($commune); - $manager->flush(); $communes[$comNum] = $commune; } $lineUseful = false; - if(in_array(null, [ - $typeTFPNB->getId(), - $typeTFPB->getId(), - $typeTH->getId(), - $typeCFE->getId(), - ])) { - } if($tauxTFPNB > 0 && $volTFPNB > 0) { $taxeTFPNB = new Taxe(); @@ -324,7 +318,7 @@ class AppFixtures extends Fixture private static function decoderExcelHex($chaine) { // Le regex cherche le motif : _x suivi de 4 caractères hexadécimaux (0-9, A-F), suivi de _ - return trim(preg_replace_callback( + return trim(mb_convert_encoding(preg_replace_callback( '/_x([0-9A-Fa-f]{4})_/', function ($matches) { // $matches[1] contient le code hexadécimal (ex: "0020") @@ -333,6 +327,6 @@ class AppFixtures extends Fixture return mb_chr(hexdec($matches[1])); }, $chaine - )); + ), 'UTF-8', 'Windows-1252')); } } diff --git a/api-platform/api/src/Entity/Taxe.php b/api-platform/api/src/Entity/Taxe.php index d402c2a..3653e67 100644 --- a/api-platform/api/src/Entity/Taxe.php +++ b/api-platform/api/src/Entity/Taxe.php @@ -18,6 +18,7 @@ use Doctrine\ORM\Mapping as ORM; new GetCollection() ], paginationClientEnabled: true, + paginationClientItemsPerPage: true, )] #[ApiFilter(SearchFilter::class, properties: [ 'type' => 'exact', @@ -33,7 +34,7 @@ class Taxe #[ORM\Column] private ?int $id = null; - #[ORM\ManyToOne()] + #[ORM\ManyToOne(cascade: ['persist'])] #[ORM\JoinColumn(nullable: false)] private ?Commune $commune = null; diff --git a/api-platform/api/src/State/AverageTaxStatsProvider.php b/api-platform/api/src/State/AverageTaxStatsProvider.php index 78c8b94..9d119b0 100644 --- a/api-platform/api/src/State/AverageTaxStatsProvider.php +++ b/api-platform/api/src/State/AverageTaxStatsProvider.php @@ -15,6 +15,7 @@ class AverageTaxStatsProvider implements ProviderInterface public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null { + ini_set('memory_limit', -1); // les fichiers excels sont tellement énormes qu'il faut beaucoup de RAM $filters = $context['filters'] ?? []; $startYear = isset($filters['startYear']) ? (int)$filters['startYear'] : 2018; diff --git a/front/src/components/ScatterPlot.tsx b/front/src/components/ScatterPlot.tsx index 845b069..7a8f2e0 100644 --- a/front/src/components/ScatterPlot.tsx +++ b/front/src/components/ScatterPlot.tsx @@ -19,6 +19,9 @@ export default function ScatterPlot({ data }: { data: Point[] }) { Communes: { label: 'Communes', color: '#0B5FFF' }, } as const; + console.log(data); + + return ( diff --git a/front/src/pages/Dashboard.tsx b/front/src/pages/Dashboard.tsx index 793b785..33a7a3c 100644 --- a/front/src/pages/Dashboard.tsx +++ b/front/src/pages/Dashboard.tsx @@ -120,9 +120,10 @@ export default function DashboardPage() { const query = new URLSearchParams({ annee: String(scYear), - "commune.departement": `/api/departements/${scDeptId}`, + "commune.departement": `${scDeptId}`, "type.code": typeObj.code, - pagination: "false", + pagination: "true", + itemsPerPage: "535955", }); const fetchData = async () => { -- GitLab From 44a150c57ac14ce9dd7dea4aa5063c7616edeccb Mon Sep 17 00:00:00 2001 From: NOPepin Date: Wed, 11 Feb 2026 20:50:39 +0100 Subject: [PATCH 2/2] corrections-communes : suppression code inutile --- api-platform/api/src/State/AverageTaxStatsProvider.php | 1 - front/src/components/ScatterPlot.tsx | 3 --- 2 files changed, 4 deletions(-) diff --git a/api-platform/api/src/State/AverageTaxStatsProvider.php b/api-platform/api/src/State/AverageTaxStatsProvider.php index 9d119b0..78c8b94 100644 --- a/api-platform/api/src/State/AverageTaxStatsProvider.php +++ b/api-platform/api/src/State/AverageTaxStatsProvider.php @@ -15,7 +15,6 @@ class AverageTaxStatsProvider implements ProviderInterface public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null { - ini_set('memory_limit', -1); // les fichiers excels sont tellement énormes qu'il faut beaucoup de RAM $filters = $context['filters'] ?? []; $startYear = isset($filters['startYear']) ? (int)$filters['startYear'] : 2018; diff --git a/front/src/components/ScatterPlot.tsx b/front/src/components/ScatterPlot.tsx index 7a8f2e0..845b069 100644 --- a/front/src/components/ScatterPlot.tsx +++ b/front/src/components/ScatterPlot.tsx @@ -19,9 +19,6 @@ export default function ScatterPlot({ data }: { data: Point[] }) { Communes: { label: 'Communes', color: '#0B5FFF' }, } as const; - console.log(data); - - return ( -- GitLab