Merge pull request 'Tableau coef : Correction bug sans data' (#369) from lehmann/ScoDoc-Front:dev93 into dev93

Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/369
This commit is contained in:
Emmanuel Viennet 2022-04-22 15:11:26 +02:00
commit ca3336e9be

View File

@ -35,9 +35,9 @@ function build_table(data) {
${cellule.data} ${cellule.data}
</div>`; </div>`;
if (cellule.editable && cellule.data) { if (cellule.editable) {
sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + parseInt(cellule.data); sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + (parseFloat(cellule.data) || 0);
sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + parseInt(cellule.data); sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + (parseFloat(cellule.data) || 0);
} }
}) })
@ -187,13 +187,13 @@ 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}"]`).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; document.querySelector(`.sums[data-x="${this.dataset.x}"][data-y="${lastY}"]`).innerText = sum;
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}"]`).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; document.querySelector(`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`).innerText = sum;
} }