Conversation
|
ericlouz c'est mon deuxième compte git. vraiment desolé poir le melange de compte |
|
Mes retours sont pour le plupart structural et sur le nommage des fichiers et variables. Sinon, c'est cool que tu as quelquechose qui nous ammène bien vers la but. Bravo. Voila mes retours: Faut garder les parentId en integer et pas varchar. C'est mieux pour les jointures et aussi pour la structure de ne pas dependre d'une donnée de domaine. Au niveau d'objets je pense qu'il y a plus de sens à avoir les objets suivants: Au niveau de responsabilites:
Imports\Themes\ExtractService
Imports\Themes\CreateService
|
.gitignore
Outdated
| /public/assets/ | ||
| /assets/vendor/ | ||
| ###< symfony/asset-mapper ### | ||
| .DS_Store |
There was a problem hiding this comment.
Il faut effacer tout les fichiers .DS_Store
migrations/Version20250221003103.php
Outdated
| public function up(Schema $schema): void | ||
| { | ||
| // this up() migration is auto-generated, please modify it to your needs | ||
| $this->addSql('CREATE TABLE theme (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, code VARCHAR(255) NOT NULL, is_section BOOLEAN NOT NULL, external_id VARCHAR(255) NOT NULL)'); |
There was a problem hiding this comment.
Je pense que ta bdd est en mauvaise etat comme la mienne ne necessite pas cette migration. En plus la fonctionne down suprimme la bdd 😅
There was a problem hiding this comment.
quand je vais merger je vais pas merger les migrations
|
|
||
| protected function configure(): void | ||
| { | ||
| $this |
src/Command/CommandIngestTheme.php
Outdated
| if ($arg1) { | ||
| $io->note(sprintf('You passed an argument: %s', $arg1)); | ||
| $excel_file = $this->projectDir.'/public/File/emissions_GES_structure.xlsx'; | ||
|
|
||
| if (!file_exists($excel_file)) { | ||
| $io->error('file does not exist'); | ||
|
|
||
| return Command::FAILURE; | ||
| } | ||
| try { | ||
| $themes = $ingestTheme->PrepareThemesForDatabase($ingestTheme->GetThemesFromExcelFile($excel_file)); | ||
| $themes = json_decode($themes); | ||
|
|
||
| // $io->success('Résultat: '.$ingestTheme->checkThemesEmpty()); | ||
| } catch (\Exception $e) { | ||
| $io->error('Erreur lors de la lecture du fichier : '.$e->getMessage()); | ||
|
|
||
| return Command::FAILURE; | ||
| } | ||
|
|
||
| return Command::SUCCESS; | ||
| } |
There was a problem hiding this comment.
Pour ce fichier, j'attend voir cet interface: https://github.com/unflores/stats_visualiser/blob/936714b32b9904ae1b1f646e6d125c7d4f7b31fa/src/Command/CommandIngestTheme.php
There was a problem hiding this comment.
Si tu veux plus en discuter j'ai des dispos. Quand on a discuté de la sortie des données, on a dit que ce sera plutot en form de php dictionary et pas json. Changes l'output s'il te plait.
There was a problem hiding this comment.
oui je suis entrain de le modifier
| private $entityManager; | ||
| private $projectDir; | ||
|
|
There was a problem hiding this comment.
ces changements n'ont pas besoin d'etre ici
src/Import/IngestTheme.php
Outdated
| private $projectDir; | ||
| private $entityManager; | ||
| private $themeRepository; | ||
|
|
There was a problem hiding this comment.
le nom, signature de certaines methodes et le dossier de ce fichier doivent changer. Regarde mon feedback d'avant pour plus d'info.
src/Command/CommandIngestTheme.php
Outdated
| return Command::FAILURE; | ||
| } | ||
| try { | ||
| $themes = $ingestTheme->PrepareThemesForDatabase($ingestTheme->GetThemesFromExcelFile($excel_file)); |
There was a problem hiding this comment.
La methode GetThemesFromExcelFile doit retourner qqch de ce format ci:
[
'P.0' => [
'code' => 'emission_ges',
'parent_id' => null,
'is_section' => true
],
'P.0.1' => [
'code' => 'emission_ges.some_child',
'parent_id' => null,
'is_section' => true
],
...
]
There was a problem hiding this comment.
dictionnaire de donnée.
There was a problem hiding this comment.
je vais finir les changement et tu vas les voir.
unflores
left a comment
There was a problem hiding this comment.
il y a encore pas mal de changements à faire.
|
Could you take a moment to review this? I’ve finished everything, and it's all completed. |
| $newSpreadsheet = new Spreadsheet(); | ||
| $newSheet = $newSpreadsheet->getActiveSheet(); |
There was a problem hiding this comment.
Je pense que ceci doit etre effacé.
| private function getParentIdByparentExternalId(string $parentExternalId): ?int | ||
| { | ||
| $result = $this->entityManager->getRepository(Theme::class) | ||
| ->createQueryBuilder('t') | ||
| ->select('t.id') | ||
| ->where('t.externalId = :externalId') | ||
| ->setParameter('externalId', $parentExternalId) | ||
| ->getQuery() | ||
| ->getOneOrNullResult(); | ||
|
|
||
| return $result['id'] ?? null; | ||
| } |
There was a problem hiding this comment.
Normalement ce genre de code dois vivre dans tes repositories, donc un theme repo.
| public function checkAllParentIdNotNull(): bool | ||
| { | ||
| $nullCount = $this->themeRepository->createQueryBuilder('t') | ||
| ->select('COUNT(t.id)') | ||
| ->where('t.id >= :startId') | ||
| ->andWhere('t.parentId IS NOT NULL') | ||
| ->setParameter('startId', 2) | ||
| ->getQuery() | ||
| ->getSingleScalarResult(); | ||
|
|
||
| return 0 === $nullCount ? false : true; | ||
| } |
There was a problem hiding this comment.
Je pense que ceci doit etre defini dans ton theme repository 🤔
| { | ||
| $ExtractServices = new ExtractService($this->entityManager, $this->projectDir); | ||
| $saveThemes = $ExtractServices->SaveThemesOnDatabase(); | ||
| $this->assertTrue($saveThemes, 'themes are not saved'); |
There was a problem hiding this comment.
les themes doivent etre sauvgardés normalement non?
| @@ -1,27 +0,0 @@ | |||
| <?php | |||
There was a problem hiding this comment.
celle-la elle n'est pas à effacer.
…is not null, except for the first theme.
…ctService.php file.
…RepositoryTest.phand ThemeTest.php file
add themes script
create themes.json
save on .json themes
no yet save on database
ParentId issue no yet fix
Deploy will require gd ext-zip extensions to be installed into php