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 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}
</div>`;
">${cellule.data}</div>`; // 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}
</div>`;
})
@ -82,7 +86,7 @@ function showSums(sumsRessources, sumsUE) {
--nbX:1;
--nbY:1;
">
${value}
${value / 100}
</div>`;
})
@ -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;
}
/******************************/

1
app/static/links/9.3.13 Symbolic link
View File

@ -0,0 +1 @@
..