diff --git a/app/static/js/table_editor.js b/app/static/js/table_editor.js index 2b6af16e09..5370594f0d 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 0000000000..a96aa0ea9d --- /dev/null +++ b/app/static/links/9.3.13 @@ -0,0 +1 @@ +.. \ No newline at end of file