Skip to content

Commit

Permalink
Merge pull request #341 from mission-apprentissage/server/fix-campagn…
Browse files Browse the repository at this point in the history
…es-for-admin

[Serveur] Répare l'affichage des campagnes en admin
  • Loading branch information
yohanngab authored Oct 29, 2024
2 parents cae2c0b + d65e5c3 commit 1172136
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/src/services/campagnes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const getCampagnes = async ({ isObserver, scope, page = 1, pageSize = 10,

if (isObserver) {
// Nécessaire pour ne pas stocker la liste de code RNCP dans le scope d'un user et réconcilier les labels/valeurs
if (scope.field === OBSERVER_SCOPES.OPCO) {
if (scope?.field === OBSERVER_SCOPES.OPCO) {
const SCOPE_LIST = getStaticFilePath("./opco.json");
const opcos = JSON.parse(fs.readFileSync(SCOPE_LIST, "utf8"));
const rncpCodes = opcos.find((opco) => opco.label === scope.value).value;
Expand Down
3 changes: 2 additions & 1 deletion server/src/services/formations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const updateFormation = async (id, updatedFormation) => {
export const getFormationsEtablissementsDiplomesWithCampagnesCount = async ({ userSiret, scope }) => {
try {
// Nécessaire pour ne pas stocker la liste de code RNCP dans le scope d'un user et réconcilier les labels/valeurs
if (scope.field === OBSERVER_SCOPES.OPCO) {
if (scope?.field === OBSERVER_SCOPES.OPCO) {
const SCOPE_LIST = getStaticFilePath("./opco.json");
const opcos = JSON.parse(fs.readFileSync(SCOPE_LIST, "utf8"));
const rncpCodes = opcos.find((opco) => opco.label === scope.value).value;
Expand Down Expand Up @@ -147,6 +147,7 @@ export const getFormationsEtablissementsDiplomesWithCampagnesCount = async ({ us

return { success: true, body: { diplomes, etablissements } };
} catch (error) {
console.log({ error });
return { success: false, body: error };
}
};

0 comments on commit 1172136

Please sign in to comment.