2021-12-06 20:58:39 +01:00
|
|
|
/* Il manque :
|
2021-12-08 21:49:13 +01:00
|
|
|
- rangs
|
|
|
|
- Synthèse : moyenne UE
|
|
|
|
- Synthèse : min, max, moy classe
|
|
|
|
- Synthèse : absences
|
|
|
|
- Eval : absences
|
2021-12-06 20:58:39 +01:00
|
|
|
|
|
|
|
Moi :
|
2021-12-08 21:49:13 +01:00
|
|
|
"show_codemodules" :true,
|
|
|
|
"show_minmax": true,
|
|
|
|
"show_minmax_eval": true,
|
|
|
|
"show_minmax_mod": false,
|
|
|
|
"show_mod_rangs": false,
|
|
|
|
"show_moypromo": true,
|
|
|
|
"show_rangs": true,
|
|
|
|
"show_ue_cap_current": true,
|
|
|
|
"show_ue_cap_details": true,
|
|
|
|
"show_ue_rangs": true,
|
|
|
|
"show_uevalid": true,
|
2021-12-06 20:58:39 +01:00
|
|
|
*/
|
|
|
|
/*****************************/
|
|
|
|
/* Gestionnaire d'événements */
|
|
|
|
/*****************************/
|
|
|
|
document.querySelectorAll(".CTA_Liste").forEach(e => {
|
2021-12-08 21:49:13 +01:00
|
|
|
e.addEventListener("click", listeOnOff)
|
2021-12-06 20:58:39 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
function listeOnOff() {
|
2021-12-08 21:49:13 +01:00
|
|
|
this.parentElement.parentElement.classList.toggle("listeOff")
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
/*****************************/
|
|
|
|
/* Recupération et affichage */
|
|
|
|
/*****************************/
|
|
|
|
|
|
|
|
fetch(dataSrc)
|
2021-12-08 21:49:13 +01:00
|
|
|
.then(r => { return r.json() })
|
|
|
|
.then(json => showData(json))
|
2021-12-06 20:58:39 +01:00
|
|
|
|
|
|
|
function showData(data) {
|
2021-12-08 21:49:13 +01:00
|
|
|
showInformations(data);
|
|
|
|
showSemestre(data);
|
|
|
|
showSynthese(data);
|
|
|
|
showEvaluations(data);
|
2021-12-06 20:58:39 +01:00
|
|
|
|
2021-12-08 21:49:13 +01:00
|
|
|
setOptions(data.options);
|
2021-12-06 20:58:39 +01:00
|
|
|
|
2021-12-08 21:49:13 +01:00
|
|
|
document.body.classList.add("ready");
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/* Informations sur l'étudiant */
|
|
|
|
/********************************/
|
|
|
|
function showInformations(data) {
|
2021-12-08 21:49:13 +01:00
|
|
|
document.querySelector(".studentPic").src = data.etudiant.photo_url || "default_Student.svg";
|
2021-12-06 20:58:39 +01:00
|
|
|
|
2021-12-08 21:49:13 +01:00
|
|
|
let output = `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div class=info_etudiant>
|
|
|
|
<div class=civilite>
|
|
|
|
${civilite(data.etudiant.civilite)}
|
|
|
|
${data.etudiant.nom}
|
|
|
|
${data.etudiant.prenom}
|
|
|
|
né${(data.etudiant.civilite == "F") ? "e" : ""} le ${ISOToDate(data.etudiant.date_naissance)}
|
|
|
|
</div>
|
|
|
|
<div class=numerosEtudiant>
|
|
|
|
Numéro étudiant : ${data.etudiant.code_nip}
|
|
|
|
Code INE : ${data.etudiant.code_ine}
|
|
|
|
</div>
|
|
|
|
<div>${data.formation.titre}</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
|
2021-12-08 21:49:13 +01:00
|
|
|
document.querySelector(".infoEtudiant").innerHTML = output;
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************/
|
|
|
|
/* Information sur le semestre */
|
|
|
|
/*******************************/
|
|
|
|
function showSemestre(data) {
|
2021-12-08 21:49:13 +01:00
|
|
|
document.querySelector("h2").innerHTML += data.semestre.numero;
|
|
|
|
document.querySelector(".dateInscription").innerHTML += ISOToDate(data.semestre.inscription);
|
|
|
|
let output = `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div>
|
|
|
|
<div class=enteteSemestre>Moyenne</div><div class=enteteSemestre>${data.semestre.notes.value}</div>
|
|
|
|
<div class=rang>Rang :</div><div class=rang>${data.semestre.rang.value} / ${data.semestre.rang.total}</div>
|
|
|
|
<div>Max. promo. :</div><div>${data.semestre.notes.max}</div>
|
|
|
|
<div>Moy. promo. :</div><div>${data.semestre.notes.moy}</div>
|
|
|
|
<div>Min. promo. :</div><div>${data.semestre.notes.min}</div>
|
|
|
|
</div>
|
|
|
|
${data.semestre.groupes.map(groupe => {
|
2021-12-08 21:49:13 +01:00
|
|
|
return `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div>
|
|
|
|
<div class=enteteSemestre>Groupe</div><div class=enteteSemestre>${groupe.nom}</div>
|
|
|
|
<div class=rang>Rang :</div><div class=rang>${groupe.rang.value} / ${groupe.rang.total}</div>
|
|
|
|
<div>Max. groupe :</div><div>${groupe.notes.max}</div>
|
|
|
|
<div>Moy. groupe :</div><div>${groupe.notes.min}</div>
|
|
|
|
<div>Min. groupe :</div><div>${groupe.notes.min}</div>
|
|
|
|
</div>
|
|
|
|
`;
|
2021-12-08 21:49:13 +01:00
|
|
|
}).join("")
|
|
|
|
}
|
2021-12-06 20:58:39 +01:00
|
|
|
`;
|
2021-12-08 21:49:13 +01:00
|
|
|
document.querySelector(".infoSemestre").innerHTML = output;
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************/
|
|
|
|
/* Synthèse */
|
|
|
|
/*******************************/
|
|
|
|
function showSynthese(data) {
|
2021-12-08 21:49:13 +01:00
|
|
|
let output = ``;
|
|
|
|
Object.entries(data.ues).forEach(([ue, dataUE]) => {
|
|
|
|
output += `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div class=ue>
|
|
|
|
<h3>
|
|
|
|
${(dataUE.competence) ? dataUE.competence + " - " : ""}${ue}
|
|
|
|
</h3>
|
|
|
|
<div>
|
2021-12-08 21:49:13 +01:00
|
|
|
<div class=moyenne>Moyenn : ${dataUE.moyenne?.value || "-"}</div>
|
2021-12-06 20:58:39 +01:00
|
|
|
<div class=info>
|
|
|
|
Bonus : ${dataUE.bonus || 0} -
|
|
|
|
Malus : ${dataUE.malus || 0}
|
|
|
|
<span class=ects> -
|
|
|
|
ECTS : ${dataUE.ECTS.acquis} / ${dataUE.ECTS.total}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class=absences>
|
|
|
|
<div>Abs inj.</div><div>${dataUE.absences?.injustifie || 0}</div>
|
|
|
|
<div>Total</div><div>${dataUE.absences?.total || 0}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
${synthese(dataUE.ressources)}
|
|
|
|
${synthese(dataUE.saes)}
|
|
|
|
`;
|
2021-12-08 21:49:13 +01:00
|
|
|
});
|
|
|
|
document.querySelector(".synthese").innerHTML = output;
|
2021-12-06 20:58:39 +01:00
|
|
|
|
2021-12-08 21:49:13 +01:00
|
|
|
function synthese(modules) {
|
|
|
|
let output = "";
|
|
|
|
Object.entries(modules).forEach(([module, dataModule]) => {
|
|
|
|
let titre = data.ressources[module]?.titre || data.saes[module]?.titre;
|
2021-12-06 22:37:49 +01:00
|
|
|
let url = data.ressources[module]?.url || data.saes[module]?.url;
|
2021-12-08 21:49:13 +01:00
|
|
|
output += `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div class=syntheseModule>
|
2021-12-06 22:37:49 +01:00
|
|
|
<div><a href="${url}">${module} - ${titre}</a></div>
|
2021-12-06 20:58:39 +01:00
|
|
|
<div>
|
|
|
|
${dataModule.moyenne}
|
|
|
|
<em>Coef. ${dataModule.coef}</em>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`;
|
2021-12-08 21:49:13 +01:00
|
|
|
})
|
|
|
|
return output;
|
|
|
|
}
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
/*******************************/
|
|
|
|
/* Evaluations */
|
|
|
|
/*******************************/
|
|
|
|
function showEvaluations(data) {
|
2021-12-08 21:49:13 +01:00
|
|
|
document.querySelector(".evaluations").innerHTML = module(data.ressources);
|
|
|
|
document.querySelector(".sae").innerHTML += module(data.saes);
|
2021-12-06 20:58:39 +01:00
|
|
|
|
2021-12-08 21:49:13 +01:00
|
|
|
function module(module) {
|
|
|
|
let output = "";
|
|
|
|
Object.entries(module).forEach(([numero, content]) => {
|
|
|
|
output += `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div>
|
|
|
|
<div class=module>
|
2021-12-06 22:37:49 +01:00
|
|
|
<h3><a href="${content.url}">${numero} - ${content.titre}</a></h3>
|
2021-12-06 20:58:39 +01:00
|
|
|
<div>
|
|
|
|
<div class=moyenne>Moyenne indicative : ${content.moyenne.value}</div>
|
|
|
|
<div class=info>
|
|
|
|
Classe : ${content.moyenne.moy} -
|
|
|
|
Max : ${content.moyenne.max} -
|
|
|
|
Min : ${content.moyenne.min}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class=absences>
|
|
|
|
<div>Abs inj.</div><div>${content.absences?.injustifie || 0}</div>
|
|
|
|
<div>Total</div><div>${content.absences?.total || 0}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
${evaluation(content.evaluations)}
|
|
|
|
</div>
|
|
|
|
`;
|
2021-12-08 21:49:13 +01:00
|
|
|
})
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
function evaluation(evaluations) {
|
|
|
|
let output = "";
|
|
|
|
evaluations.forEach(eval => {
|
|
|
|
output += `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div class=eval>
|
|
|
|
<div>${eval.description}</div>
|
|
|
|
<div>
|
|
|
|
${eval.note.value}
|
|
|
|
<em>Coef. ${eval.coef}</em>
|
|
|
|
</div>
|
|
|
|
<div class=complement>
|
|
|
|
<div>Coef</div><div>${eval.coef}</div>
|
|
|
|
<div>Max. promo.</div><div>${eval.note.max}</div>
|
|
|
|
<div>Moy. promo.</div><div>${eval.note.moy}</div>
|
|
|
|
<div>Min. promo.</div><div>${eval.note.min}</div>
|
|
|
|
${Object.entries(eval.poids).map(([UE, poids]) => {
|
2021-12-08 21:49:13 +01:00
|
|
|
return `
|
2021-12-06 20:58:39 +01:00
|
|
|
<div>Poids ${UE}</div>
|
|
|
|
<div>${poids}</div>
|
|
|
|
`;
|
2021-12-08 21:49:13 +01:00
|
|
|
}).join("")}
|
2021-12-06 20:58:39 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`;
|
2021-12-08 21:49:13 +01:00
|
|
|
})
|
|
|
|
return output;
|
|
|
|
}
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************/
|
|
|
|
/* Options */
|
|
|
|
/********************/
|
|
|
|
function setOptions(options) {
|
2021-12-08 21:49:13 +01:00
|
|
|
Object.entries(options).forEach(([option, value]) => {
|
|
|
|
if (value === false) {
|
|
|
|
document.body.classList.add(option.replace("show", "hide"))
|
|
|
|
}
|
|
|
|
})
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************/
|
|
|
|
/* Fonctions d'aide */
|
|
|
|
/********************/
|
|
|
|
function civilite(txt) {
|
2021-12-08 21:49:13 +01:00
|
|
|
switch (txt) {
|
|
|
|
case "M": return "M.";
|
|
|
|
case "F": return "Mme";
|
|
|
|
default: return "";
|
|
|
|
}
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function ISOToDate(ISO) {
|
2021-12-08 21:49:13 +01:00
|
|
|
return ISO.split("-").reverse().join("/");
|
2021-12-06 20:58:39 +01:00
|
|
|
}
|