diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index b2d73c100..4ad8d380d 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -1389,6 +1389,11 @@ function generateAllEtudRow() { etuds[a].nom > etuds[b].nom ? 1 : etuds[b].nom > etuds[a].nom ? -1 : 0 ); + let mod = getModuleImplId(); + etuds_ids = etuds_ids.filter((i) => { + return checkInscriptionModule(mod, i); + }); + for (let i = 0; i < etuds_ids.length; i++) { const etud = etuds[etuds_ids[i]]; insertEtudRow(etud, i + 1); @@ -1764,3 +1769,25 @@ function getUser(obj) { return obj.user_nom_complet || obj.user_id; } + +const inscriptionsModule = {}; + +function checkInscriptionModule(moduleimpl_id, etudid) { + if ([null, "", "autre"].indexOf(moduleimpl_id) !== -1) return true; + if (!inscriptionsModule.hasOwnProperty(moduleimpl_id)) { + const path = getUrl() + `/api/moduleimpl/${moduleimpl_id}/inscriptions`; + sync_get( + path, + (data, status) => { + inscriptionsModule[moduleimpl_id] = data; + }, + (data, status) => { + //error + console.error(data, status); + errorAlert(); + } + ); + } + const etudsInscrits = inscriptionsModule[moduleimpl_id].map((i) => i.etudid); + return etudsInscrits.indexOf(Number(etudid)) !== -1; +} diff --git a/app/templates/assiduites/pages/signal_assiduites_group.j2 b/app/templates/assiduites/pages/signal_assiduites_group.j2 index cac99bca5..5a7c09fec 100644 --- a/app/templates/assiduites/pages/signal_assiduites_group.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_group.j2 @@ -18,7 +18,8 @@