1
0
forked from ScoDoc/ScoDoc

Edit coef : correction flotants + somme ne prend plus en compte les bonus

This commit is contained in:
Sébastien Lehmann 2022-07-04 16:42:10 +02:00
parent 3e62d9b425
commit 9bf05dd9cd
2 changed files with 19 additions and 14 deletions

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 @@
..