Skip to content

Commit

Permalink
♻️ Gf
Browse files Browse the repository at this point in the history
  • Loading branch information
benjlevesque committed Feb 21, 2025
1 parent 75729d5 commit 65f5592
Showing 1 changed file with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import chardet from 'chardet';
import { mediator } from 'mediateur';

import { Option } from '@potentiel-libraries/monads';
import { DateTime, Email, IdentifiantProjet, StatutProjet } from '@potentiel-domain/common';
import { GarantiesFinancières } from '@potentiel-domain/laureat';
import { DateTime, Email, IdentifiantProjet } from '@potentiel-domain/common';
import { GarantiesFinancières, Lauréat } from '@potentiel-domain/laureat';
import { findProjection, listProjection } from '@potentiel-infrastructure/pg-projections';
import { loadAggregate } from '@potentiel-infrastructure/pg-event-sourcing';
import {
Expand Down Expand Up @@ -106,10 +106,6 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
count: number;
content: Array<string>;
};
projetÉliminé: {
count: number;
content: Array<string>;
};
attestationAjoutée: {
count: number;
content: Array<string>;
Expand Down Expand Up @@ -137,10 +133,6 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
count: 0,
content: [],
},
projetÉliminé: {
count: 0,
content: [],
},
attestationAjoutée: {
count: 0,
content: [],
Expand Down Expand Up @@ -181,8 +173,8 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

const identifiantProjet = IdentifiantProjet.convertirEnValueType(formattedFileName);

const projet = await mediator.send<Candidature.ConsulterProjetQuery>({
type: 'Candidature.Query.ConsulterProjet',
const projet = await mediator.send<Lauréat.ConsulterLauréatQuery>({
type: 'Lauréat.Query.ConsulterLauréat',
data: {
identifiantProjet: identifiantProjet.formatter(),
},
Expand All @@ -197,15 +189,6 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
continue;
}

/**
* Si le projet est éliminé, on ne fait rien car les projets éliminés ne doivent pas avoir de garanties financières
*/
if (StatutProjet.convertirEnValueType(projet.statut).estÉliminé()) {
statistics.projetÉliminé.count++;
statistics.projetÉliminé.content.push(identifiantProjet.formatter());
continue;
}

const gf = await mediator.send<GarantiesFinancières.ConsulterGarantiesFinancièresQuery>({
type: 'Lauréat.GarantiesFinancières.Query.ConsulterGarantiesFinancières',
data: {
Expand Down Expand Up @@ -262,14 +245,14 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

if (!période) {
statistics.errors.content.push(
`❌ ${identifiantProjet.formatter()} (${projet.nom}) : Période non trouvée`,
`❌ ${identifiantProjet.formatter()} (${projet.nomProjet}) : Période non trouvée`,
);
continue;
}

if (!période.estNotifiée || !période.notifiéeLe) {
statistics.errors.content.push(
`❌ ${identifiantProjet.formatter()} (${projet.nom}) : Période non notifiée`,
`❌ ${identifiantProjet.formatter()} (${projet.nomProjet}) : Période non notifiée`,
);
continue;
}
Expand Down Expand Up @@ -306,7 +289,6 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

console.log(`❌ Nombre de fichiers non compatibles : ${statistics.fichiersNonCompatibles.count}`);
console.log(`❓ Nombre de projets inconnu dans potentiel : ${statistics.projetInconnu.count}`);
console.log(`☠️ Nombre de projets éliminés : ${statistics.projetÉliminé.count}`);
console.log(
`ℹ️ Nombre d'attestations déjà existantes : ${statistics.attestationExistante.count}`,
);
Expand Down

0 comments on commit 65f5592

Please sign in to comment.