From bae33cf86b79294f11f22f214a7ad2e5e8b98a7a Mon Sep 17 00:00:00 2001 From: lehmann Date: Fri, 22 Apr 2022 14:57:37 +0200 Subject: [PATCH] Tableau coef : Correction bug sans data --- app/static/js/table_editor.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/static/js/table_editor.js b/app/static/js/table_editor.js index 681af697..cfd60d1e 100644 --- a/app/static/js/table_editor.js +++ b/app/static/js/table_editor.js @@ -35,9 +35,9 @@ function build_table(data) { ${cellule.data} `; - if (cellule.editable && cellule.data) { - sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + parseInt(cellule.data); - sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + parseInt(cellule.data); + if (cellule.editable) { + sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + (parseFloat(cellule.data) || 0); + sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + (parseFloat(cellule.data) || 0); } }) @@ -187,13 +187,13 @@ function keyCell(event) { function processSums() { let sum = 0; document.querySelectorAll(`[data-editable="true"][data-x="${this.dataset.x}"]`).forEach(e => { - sum += parseInt(e.innerText) || 0; + sum += parseFloat(e.innerText) || 0; }) document.querySelector(`.sums[data-x="${this.dataset.x}"][data-y="${lastY}"]`).innerText = sum; sum = 0; document.querySelectorAll(`[data-editable="true"][data-y="${this.dataset.y}"]`).forEach(e => { - sum += parseInt(e.innerText) || 0; + sum += parseFloat(e.innerText) || 0; }) document.querySelector(`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`).innerText = sum; }