Skip to content

Commit

Permalink
fix: script de mise à jour des status à partir de l historique_statut (
Browse files Browse the repository at this point in the history
  • Loading branch information
nkrmr authored Apr 25, 2024
1 parent 7681cd2 commit 0dc8a1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/src/common/actions/effectifs.statut.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,12 @@ function determineNewStatutFromHistorique(
sortedHistoriqueStatut.shift();
}

let earliestStatutDate = new Date(sortedHistoriqueStatut[0].date_statut);
if (sortedHistoriqueStatut.length > 0 && sortedHistoriqueStatut[0].date_statut) {
let earliestStatutDate = new Date(sortedHistoriqueStatut[0].date_statut);

if (earliestStatutDate < inscriptionDate) {
inscriptionDate = earliestStatutDate;
if (earliestStatutDate < inscriptionDate) {
inscriptionDate = earliestStatutDate;
}
}

const parcours: { valeur: StatutApprenant; date: Date }[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { addJob } from "job-processor";

export const up = async () => {
await addJob({ name: "tmp:effectifs:update_computed_statut", queued: true });
};

0 comments on commit 0dc8a1b

Please sign in to comment.