Correctif relevé tri UEs capitalisées

This commit is contained in:
Sébastien Lehmann 2022-12-14 16:54:28 +01:00
parent 3d11ae7a08
commit 9fe46de3b0
2 changed files with 41 additions and 55 deletions

View File

@ -279,6 +279,17 @@ section>div:nth-child(1) {
background: var(--couleurFondTitresSAE) !important; background: var(--couleurFondTitresSAE) !important;
color: #000 !important; color: #000 !important;
} }
/* UE Capitalisée */
.synthese .ue.capitalisee,
.ue.capitalisee>h3{
background: var(--couleurFondTitresUECapitalisee);;
}
.synthese .ue.capitalisee>h3::before{
content: "Capitalisée : ";
}
.synthese .ue.capitalisee .ue_rang{
display: none;
}
/***************/ /***************/
/* Evaluations */ /* Evaluations */
@ -294,6 +305,7 @@ section>div:nth-child(1) {
padding: 4px 32px; padding: 4px 32px;
border-radius: 4px; border-radius: 4px;
display: flex; display: flex;
align-items: center;
gap: 16px; gap: 16px;
margin: 4px 0 2px 0; margin: 4px 0 2px 0;
overflow-x: auto; overflow-x: auto;
@ -337,8 +349,6 @@ section>div:nth-child(1) {
} }
h3 { h3 {
display: flex;
align-items: center;
margin: 0 auto 0 0; margin: 0 auto 0 0;
position: sticky; position: sticky;
left: -32px; left: -32px;

View File

@ -305,7 +305,16 @@ class releveBUT extends HTMLElement {
/*******************************/ /*******************************/
showSynthese(data) { showSynthese(data) {
let output = ``; let output = ``;
Object.entries(data.ues).forEach(([ue, dataUE]) => { /* Fusion et tri des UE et UE capitalisées */
let fusionUE = [
...Object.entries(data.ues),
...Object.entries(data.ues_capitalisees)
].sort((a, b) => {
return a[1].numero - b[1].numero
});
/* Affichage */
fusionUE.forEach(([ue, dataUE]) => {
if (dataUE.type == 1) { // UE Sport / Bonus if (dataUE.type == 1) { // UE Sport / Bonus
output += ` output += `
<div> <div>
@ -319,17 +328,22 @@ class releveBUT extends HTMLElement {
} else { } else {
output += ` output += `
<div> <div>
<div class=ue> <div class="ue ${dataUE.date_capitalisation?"capitalisee":""}">
<h3> <h3>
${ue}${(dataUE.titre) ? " - " + dataUE.titre : ""} ${ue}${(dataUE.titre) ? " - " + dataUE.titre : ""}
</h3> </h3>
<div> <div>
<div class=moyenne>Moyenne&nbsp;:&nbsp;${dataUE.moyenne?.value ?? "-"}</div> <div class=moyenne>Moyenne&nbsp;:&nbsp;${dataUE.moyenne?.value || dataUE.moyenne || "-"}</div>
<div class=ue_rang>Rang&nbsp;:&nbsp;${dataUE.moyenne?.rang}&nbsp;/&nbsp;${dataUE.moyenne?.total}</div> <div class=ue_rang>Rang&nbsp;:&nbsp;${dataUE.moyenne?.rang}&nbsp;/&nbsp;${dataUE.moyenne?.total}</div>
<div class=info> <div class=info>`;
Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;- if(!dataUE.date_capitalisation){
Malus&nbsp;:&nbsp;${dataUE.malus || 0} output += ` Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;-
<span class=ects>&nbsp;- Malus&nbsp;:&nbsp;${dataUE.malus || 0}`;
} else {
output += ` le ${this.ISOToDate(dataUE.date_capitalisation.split("T")[0])} <a href="${dataUE.bul_orig_url}">dans ce semestre</a>`;
}
output += ` <span class=ects>&nbsp;-
ECTS&nbsp;:&nbsp;${dataUE.ECTS?.acquis ?? "-"}&nbsp;/&nbsp;${dataUE.ECTS?.total ?? "-"} ECTS&nbsp;:&nbsp;${dataUE.ECTS?.acquis ?? "-"}&nbsp;/&nbsp;${dataUE.ECTS?.total ?? "-"}
</span> </span>
</div> </div>
@ -338,57 +352,19 @@ class releveBUT extends HTMLElement {
<div>Abs&nbsp;N.J.</div><div>${dataUE.absences?.injustifie || 0}</div> <div>Abs&nbsp;N.J.</div><div>${dataUE.absences?.injustifie || 0}</div>
<div>Total</div><div>${dataUE.absences?.total || 0}</div> <div>Total</div><div>${dataUE.absences?.total || 0}</div>
</div>*/ </div>*/
output += ` output += "</div>";
</div>
${this.synthese(data, dataUE.ressources)} if(!dataUE.date_capitalisation){
${this.synthese(data, dataUE.saes)} output +=
</div> this.synthese(data, dataUE.ressources) +
`; this.synthese(data, dataUE.saes);
/* UE capitalisées */
if (data.ues_capitalisees !== undefined) {
if (ue in data.ues_capitalisees) {
output += this.show_ue_capitalisee(ue, data.ues_capitalisees[ue]);
delete data.ues_capitalisees[ue];
}
} }
output += "</div>";
} }
}); });
/* UE capitalisées seulement (non déjà vues) */
if (data.ues_capitalisees !== undefined) {
Object.entries(data.ues_capitalisees).forEach(([ue, ue_cap]) => {
output += this.show_ue_capitalisee(ue, data.ues_capitalisees[ue]);
});
}
this.shadow.querySelector(".synthese").innerHTML = output; this.shadow.querySelector(".synthese").innerHTML = output;
} }
show_ue_capitalisee(ue, ue_cap) {
let date_capitalisation = new Date(ue_cap.date_capitalisation).toLocaleString("fr-FR");
let link_sem = "";
if (ue_cap.bul_orig_url != null) {
link_sem = `<a href="${ue_cap.bul_orig_url}">dans ce semestre</a>`;
}
return `
<div>
<div class="ue ue_capitalisee">
<h3>
Capitalisée : ${ue}${(ue_cap.titre) ? " - " + ue_cap.titre : ""}
</h3>
<div>
<div class=moyenne>Moyenne&nbsp;:&nbsp;${ue_cap.moyenne ?? "-"}</div>
<div class=info>
le ${date_capitalisation} ${link_sem}
<span class=ects>&nbsp;
ECTS&nbsp;:&nbsp;${ue_cap.ECTS?.acquis ?? "-"}&nbsp;/&nbsp;${ue_cap.ECTS?.total ?? "-"}
</span>
</div>
</div>
</div>
</div>`;
}
synthese(data, modules) { synthese(data, modules) {
let output = ""; let output = "";
Object.entries(modules).forEach(([module, dataModule]) => { Object.entries(modules).forEach(([module, dataModule]) => {