From 3e62d9b425e7ff3542c8542266c4e2e84750a0e2 Mon Sep 17 00:00:00 2001 From: lehmann Date: Mon, 4 Jul 2022 16:38:26 +0200 Subject: [PATCH 1/2] Edit coef : correction nombres flotant & somme sans bonus --- app/static/js/releve-but.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/static/js/releve-but.js b/app/static/js/releve-but.js index 1c04c9379..edfdf79f1 100644 --- a/app/static/js/releve-but.js +++ b/app/static/js/releve-but.js @@ -243,9 +243,11 @@ class releveBUT extends HTMLElement { 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]; } - 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("#ects_tot").innerHTML = "ECTS : " + (data.semestre.ECTS?.acquis ?? "-") + " / " + (data.semestre.ECTS?.total ?? "-"); } From 9bf05dd9cde6d0c86157bc2afe2a2eb3049e83dc Mon Sep 17 00:00:00 2001 From: lehmann Date: Mon, 4 Jul 2022 16:42:10 +0200 Subject: [PATCH 2/2] Edit coef : correction flotants + somme ne prend plus en compte les bonus --- app/static/js/table_editor.js | 32 ++++++++++++++++++-------------- app/static/links/9.3.13 | 1 + 2 files changed, 19 insertions(+), 14 deletions(-) create mode 120000 app/static/links/9.3.13 diff --git a/app/static/js/table_editor.js b/app/static/js/table_editor.js index 2b6af16e0..5370594f0 100644 --- a/app/static/js/table_editor.js +++ b/app/static/js/table_editor.js @@ -11,6 +11,7 @@ function build_table(data) { let output = ""; let sumsUE = {}; let sumsRessources = {}; + let value; data.forEach((cellule) => { output += ` @@ -31,13 +32,16 @@ function build_table(data) { --y:${cellule.y}; --nbX:${cellule.nbX || 1}; --nbY: ${cellule.nbY || 1}; - "> - ${cellule.data} - `; - + ">${cellule.data}`; // ne pas mettre d'espace car c'est utilisé par :not(:empty) après + if (cellule.style.includes("champs")) { - sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + (parseFloat(cellule.data) || 0); - sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + (parseFloat(cellule.data) || 0); + if (cellule.editable == true && cellule.data) { + 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; --nbY:1; "> - ${value} + ${value / 100} `; }) @@ -82,7 +86,7 @@ function showSums(sumsRessources, sumsUE) { --nbX:1; --nbY:1; "> - ${value} + ${value / 100} `; }) @@ -186,16 +190,16 @@ function keyCell(event) { function processSums() { let sum = 0; - document.querySelectorAll(`[data-editable="true"][data-x="${this.dataset.x}"]`).forEach(e => { - sum += parseFloat(e.innerText) || 0; + document.querySelectorAll(`[data-editable="true"][data-x="${this.dataset.x}"]:not(:empty)`).forEach(e => { + 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; - document.querySelectorAll(`[data-editable="true"][data-y="${this.dataset.y}"]`).forEach(e => { - sum += parseFloat(e.innerText) || 0; + document.querySelectorAll(`[data-editable="true"][data-y="${this.dataset.y}"]:not(:empty)`).forEach(e => { + 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; } /******************************/ diff --git a/app/static/links/9.3.13 b/app/static/links/9.3.13 new file mode 120000 index 000000000..a96aa0ea9 --- /dev/null +++ b/app/static/links/9.3.13 @@ -0,0 +1 @@ +.. \ No newline at end of file