Merge pull request 'Edit coef : correction flottants + somme ne prend plus en compte les bonus' (#427) from lehmann/ScoDoc-Front:master into master

Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/427
This commit is contained in:
Emmanuel Viennet 2022-07-04 17:13:49 +02:00
commit 0ad0521a6e
3 changed files with 23 additions and 16 deletions

View File

@ -243,9 +243,11 @@ class releveBUT extends HTMLElement {
if(data.semestre.decision_annee?.code){ if(data.semestre.decision_annee?.code){
this.shadow.querySelector(".decision_annee").innerHTML = "Décision année : " + data.semestre.decision_annee.code + " - " + correspondanceCodes[data.semestre.decision_annee.code]; this.shadow.querySelector(".decision_annee").innerHTML = "Décision année : " + data.semestre.decision_annee.code + " - " + correspondanceCodes[data.semestre.decision_annee.code];
} }
if (data.semestre.decision?.code) {
this.shadow.querySelector(".decision").innerHTML = data.semestre.situation || "";
/*if (data.semestre.decision?.code) {
this.shadow.querySelector(".decision").innerHTML = "Décision jury: " + (data.semestre.decision?.code || ""); this.shadow.querySelector(".decision").innerHTML = "Décision jury: " + (data.semestre.decision?.code || "");
} }*/
this.shadow.querySelector("#ects_tot").innerHTML = "ECTS : " + (data.semestre.ECTS?.acquis ?? "-") + " / " + (data.semestre.ECTS?.total ?? "-"); this.shadow.querySelector("#ects_tot").innerHTML = "ECTS : " + (data.semestre.ECTS?.acquis ?? "-") + " / " + (data.semestre.ECTS?.total ?? "-");
} }

View File

@ -11,6 +11,7 @@ function build_table(data) {
let output = ""; let output = "";
let sumsUE = {}; let sumsUE = {};
let sumsRessources = {}; let sumsRessources = {};
let value;
data.forEach((cellule) => { data.forEach((cellule) => {
output += ` output += `
@ -31,13 +32,16 @@ function build_table(data) {
--y:${cellule.y}; --y:${cellule.y};
--nbX:${cellule.nbX || 1}; --nbX:${cellule.nbX || 1};
--nbY: ${cellule.nbY || 1}; --nbY: ${cellule.nbY || 1};
"> ">${cellule.data}</div>`; // ne pas mettre d'espace car c'est utilisé par :not(:empty) après
${cellule.data}
</div>`;
if (cellule.style.includes("champs")) { if (cellule.style.includes("champs")) {
sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + (parseFloat(cellule.data) || 0); if (cellule.editable == true && cellule.data) {
sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + (parseFloat(cellule.data) || 0); value = parseFloat(cellule.data) *100;
} else {
value = 0;
}
sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + value;
sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + value;
} }
}) })
@ -65,7 +69,7 @@ function showSums(sumsRessources, sumsUE) {
--nbX:1; --nbX:1;
--nbY:1; --nbY:1;
"> ">
${value} ${value / 100}
</div>`; </div>`;
}) })
@ -82,7 +86,7 @@ function showSums(sumsRessources, sumsUE) {
--nbX:1; --nbX:1;
--nbY:1; --nbY:1;
"> ">
${value} ${value / 100}
</div>`; </div>`;
}) })
@ -186,16 +190,16 @@ function keyCell(event) {
function processSums() { function processSums() {
let sum = 0; let sum = 0;
document.querySelectorAll(`[data-editable="true"][data-x="${this.dataset.x}"]`).forEach(e => { document.querySelectorAll(`[data-editable="true"][data-x="${this.dataset.x}"]:not(:empty)`).forEach(e => {
sum += parseFloat(e.innerText) || 0; sum += parseFloat(e.innerText) * 100;
}) })
document.querySelector(`.sums[data-x="${this.dataset.x}"][data-y="${lastY}"]`).innerText = sum; document.querySelector(`.sums[data-x="${this.dataset.x}"][data-y="${lastY}"]`).innerText = sum / 100;
sum = 0; sum = 0;
document.querySelectorAll(`[data-editable="true"][data-y="${this.dataset.y}"]`).forEach(e => { document.querySelectorAll(`[data-editable="true"][data-y="${this.dataset.y}"]:not(:empty)`).forEach(e => {
sum += parseFloat(e.innerText) || 0; sum += parseFloat(e.innerText) * 100;
}) })
document.querySelector(`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`).innerText = sum; document.querySelector(`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`).innerText = sum / 100;
} }
/******************************/ /******************************/

1
app/static/links/9.3.13 Symbolic link
View File

@ -0,0 +1 @@
..