Skip to content

Commit

Permalink
🐛 Import d'une candidature CRE4 sans type de GF (#2711)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Hubert MONCENIS <[email protected]>
  • Loading branch information
benjlevesque and HubM authored Feb 11, 2025
1 parent 1d7e7a0 commit ec12c7e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .demo/exampleCandidatsCRE4.csv
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ N
(AO sol)";"Codes cas
(AO sol)";"Codes cas
(AO sol)";Motif d'�limination;Nom projet (doublon);CP (doublon);Commune (doublon);Modifications;Statut;Notification;Commentaires
Test 1;CRE4 - B�timent;1;2;HISTORIQUE1;;HISTORIQUE1;1;;1;;0,5;1;;300;1;2;3;;6;;SD3B;Personne morale;;;PME;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Centrale Solaire;2;0,5;;;;5 avenue laeticia;13010;MARSEILLE;;Bouches-Du-Rh�ne;;;;;;;;;;;;N/A;;1;300;;;;;Silicium polycristallin;123;MODULE PV;France;360;18,26%;CELLULE PV;France;PLAQUETTE PV;France;POLYSI PV;France;CONVERT PV;France;;;;;;;;;;1820;6342;1469;01/11/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Class�;;;;;;;;;;;21/10/2020;
Test 2;CRE4 - B�timent;1;2;HISTORIQUE2;;HISTORIQUE2;2;01/01/2027;2;;0,5;1;;300;1;2;3;;6;;SD3B;Personne morale;;;PME;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Centrale Solaire;2;0,5;;;;1 impasse des capucins;20000;AJACCIO;;Corse;;;;;;;;;;;;N/A;;1;300;;;;;Silicium polycristallin;123;MODULE PV;France;360;18,26%;CELLULE PV;France;PLAQUETTE PV;France;POLYSI PV;France;CONVERT PV;France;;;;;;;;;;1820;6342;1469;01/11/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Class�;;;;;;;;;;;21/10/2020;
Test 3;CRE4 - B�timent;10;2;NON-HISTORIQUE1;;NON-HISTORIQUE1;3;;1;;1,2;1;;400;4;5;6;;15;;SD3C;Personne morale;;;Grande entreprise;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Face Nord;2;1,2;;;;2 rue de l'avenue;92800;PUTEAUX;;Ile-de-France;;;;;;;;;;;;;;1;400;;Oui;;;Silicium monocristallin;456;MODULE PV;Chine;400;19,70%;CELLULE PV;Chine;PLAQUETTE PV;Chine;POLYSI PV;Chine;CONVERT PV;Chine;;;;;;;;;;2055;5200;1585;01/12/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Favorable;;;;Class�;;;;;;;;;;;;
Test 4;CRE4 - B�timent;10;2;NON-HISTORIQUE2;;NON-HISTORIQUE2;1;;4;;1,2;1;;400;4;5;6;;15;;SD3C;Personne morale;;;Grande entreprise;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Face Nord;2;1,2;;;;1 rue de Bordeaux;33000 / 33100;BORDEAUX;;Nouvelle-Aquitaine;;;;;;;;;;;;;;1;400;;Oui;;;Silicium monocristallin;456;MODULE PV;Chine;400;19,70%;CELLULE PV;Chine;PLAQUETTE PV;Chine;POLYSI PV;Chine;CONVERT PV;Chine;;;;;;;;;;2055;5200;1585;01/12/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Favorable;;;;Class�;;;;;;;;;;;;
Test 5;CRE4 - B�timent;10;2;NON-HISTORIQUE3;;NON-HISTORIQUE3;2;01/03/2030;1;;1,2;1;;400;4;5;6;;15;;SD3C;Personne morale;;;Grande entreprise;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Face Nord;2;1,2;;;;2 rue de Bordeaux;33000 / 33200;BORDEAUX;;Nouvelle-Aquitaine;;;;;;;;;;;;;;1;400;;Oui;;;Silicium monocristallin;456;MODULE PV;Chine;400;19,70%;CELLULE PV;Chine;PLAQUETTE PV;Chine;POLYSI PV;Chine;CONVERT PV;Chine;;;;;;;;;;2055;5200;1585;01/12/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Favorable;;;;Elimin�;;;;;prix;;;;;;;
Test 1;CRE4 - B�timent;1;2;HISTORIQUE1;;HISTORIQUE1;;;1;;0,5;1;;300;1;2;3;;6;;SD3B;Personne morale;;;PME;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Centrale Solaire;2;0,5;;;;5 avenue laeticia;13010;MARSEILLE;;Bouches-Du-Rh�ne;;;;;;;;;;;;N/A;;1;300;;;;;Silicium polycristallin;123;MODULE PV;France;360;18,26%;CELLULE PV;France;PLAQUETTE PV;France;POLYSI PV;France;CONVERT PV;France;;;;;;;;;;1820;6342;1469;01/11/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Class�;;;;;;;;;;;21/10/2020;
Test 2;CRE4 - B�timent;1;2;HISTORIQUE2;;HISTORIQUE2;;01/01/2027;2;;0,5;1;;300;1;2;3;;6;;SD3B;Personne morale;;;PME;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Centrale Solaire;2;0,5;;;;1 impasse des capucins;20000;AJACCIO;;Corse;;;;;;;;;;;;N/A;;1;300;;;;;Silicium polycristallin;123;MODULE PV;France;360;18,26%;CELLULE PV;France;PLAQUETTE PV;France;POLYSI PV;France;CONVERT PV;France;;;;;;;;;;1820;6342;1469;01/11/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Class�;;;;;;;;;;;21/10/2020;
Test 3;CRE4 - B�timent;10;2;NON-HISTORIQUE1;;NON-HISTORIQUE1;;;1;;1,2;1;;400;4;5;6;;15;;SD3C;Personne morale;;;Grande entreprise;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Face Nord;2;1,2;;;;2 rue de l'avenue;92800;PUTEAUX;;Ile-de-France;;;;;;;;;;;;;;1;400;;Oui;;;Silicium monocristallin;456;MODULE PV;Chine;400;19,70%;CELLULE PV;Chine;PLAQUETTE PV;Chine;POLYSI PV;Chine;CONVERT PV;Chine;;;;;;;;;;2055;5200;1585;01/12/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Favorable;;;;Class�;;;;;;;;;;;;
Test 4;CRE4 - B�timent;10;2;NON-HISTORIQUE2;;NON-HISTORIQUE2;;;4;;1,2;1;;400;4;5;6;;15;;SD3C;Personne morale;;;Grande entreprise;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Face Nord;2;1,2;;;;1 rue de Bordeaux;33000 / 33100;BORDEAUX;;Nouvelle-Aquitaine;;;;;;;;;;;;;;1;400;;Oui;;;Silicium monocristallin;456;MODULE PV;Chine;400;19,70%;CELLULE PV;Chine;PLAQUETTE PV;Chine;POLYSI PV;Chine;CONVERT PV;Chine;;;;;;;;;;2055;5200;1585;01/12/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Favorable;;;;Class�;;;;;;;;;;;;
Test 5;CRE4 - B�timent;10;2;NON-HISTORIQUE3;;NON-HISTORIQUE3;;01/03/2030;1;;1,2;1;;400;4;5;6;;15;;SD3C;Personne morale;;;Grande entreprise;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Face Nord;2;1,2;;;;2 rue de Bordeaux;33000 / 33200;BORDEAUX;;Nouvelle-Aquitaine;;;;;;;;;;;;;;1;400;;Oui;;;Silicium monocristallin;456;MODULE PV;Chine;400;19,70%;CELLULE PV;Chine;PLAQUETTE PV;Chine;POLYSI PV;Chine;CONVERT PV;Chine;;;;;;;;;;2055;5200;1585;01/12/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Favorable;;;;Elimin�;;;;;prix;;;;;;;
Test 6;Eolien;8;;EOLIEN P8 DEMANDE CHANGEMENT ACTIONNAIRE;;EOLIEN P8 DEMANDE CHANGEMENT ACTIONNAIRE;;;1;;0,5;1;;300;1;2;3;;6;;SD3B;Personne morale;;;PME;;;Valentin COGNITO;G�rant;;Valentin Cognito;Directeur du d�veloppement;1 place carpeaux;[email protected];;Centrale Solaire;2;0,5;;;;5 avenue laeticia;13010;MARSEILLE;;Bouches-Du-Rh�ne;;;;;;;;;;;;N/A;;1;300;;;;;Silicium polycristallin;123;MODULE PV;France;360;18,26%;CELLULE PV;France;PLAQUETTE PV;France;POLYSI PV;France;CONVERT PV;France;;;;;;;;;;1820;6342;1469;01/11/2021;;;;;;;;;;;;;;;;;;Non;Non;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Class�;;;;;;;;;;;21/10/2020;
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,36 @@ describe('Schema candidature', () => {
path: ['Financement collectif (Oui/Non)', 'Gouvernance partagée (Oui/Non)'],
});
});

test('le type de GF est obligatoire pour projet classé PPE2', () => {
const result = candidatureCsvSchema.safeParse({
...minimumValuesClassé,
"Appel d'offres": 'PPE2 - Eolien',
"1. Garantie financière jusqu'à 6 mois après la date d'achèvement\n2. Garantie financière avec date d'échéance et à renouveler\n3. Consignation":
undefined,
});
assert(!result.success);
expect(result.error.errors[0]).to.deep.eq({
code: 'invalid_type',
expected: 'string',
received: 'undefined',
path: [
"1. Garantie financière jusqu'à 6 mois après la date d'achèvement\n2. Garantie financière avec date d'échéance et à renouveler\n3. Consignation",
],
message:
'"1. Garantie financière jusqu\'à 6 mois après la date d\'achèvement\n2. Garantie financière avec date d\'échéance et à renouveler\n3. Consignation" est requis lorsque "Classé ?" a la valeur "classé"',
});
});

test("le type de GF n'est pas obligatoire pour projet classé CRE4", () => {
const result = candidatureCsvSchema.safeParse({
...minimumValuesClassé,
"Appel d'offres": 'Eolien',
"1. Garantie financière jusqu'à 6 mois après la date d'achèvement\n2. Garantie financière avec date d'échéance et à renouveler\n3. Consignation":
undefined,
});
assertNoError(result);
});
});

describe('Cas particuliers', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ const candidatureCsvRowSchema = z
// le type de GF est obligatoire si la candidature est classée
.superRefine((obj, ctx) => {
const actualStatut = statut[obj[colonnes.statut]];
if (actualStatut === 'classé' && !obj[colonnes.typeGf]) {
const ao = obj[colonnes.appelOffre];
const isPPE2 = ao.startsWith('PPE2');
if (isPPE2 && actualStatut === 'classé' && !obj[colonnes.typeGf]) {
ctx.addIssue(conditionalRequiredError(colonnes.typeGf, colonnes.statut, actualStatut));
}
})
Expand Down

0 comments on commit ec12c7e

Please sign in to comment.