add count for points
This commit is contained in:
parent
3958a610f9
commit
8e0b2d874c
49
main.js
49
main.js
@ -1907,10 +1907,55 @@
|
|||||||
finishRow.querySelector(`td`).colSpan = 4
|
finishRow.querySelector(`td`).colSpan = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeStatsSpan(text) {
|
||||||
|
let statsSpan = document.createElement("span")
|
||||||
|
statsSpan.textContent = text
|
||||||
|
statsSpan.classList.add("stats")
|
||||||
|
|
||||||
|
return statsSpan
|
||||||
|
}
|
||||||
|
|
||||||
|
function countCp() {
|
||||||
|
let rows = getRows()
|
||||||
|
|
||||||
|
let fullCount = 0
|
||||||
|
let stageCount = 0
|
||||||
|
let stageRow = null
|
||||||
|
for (const [i, row] of rows.entries()) {
|
||||||
|
if (i < 2) continue
|
||||||
|
let isFinish = row.querySelector(".attention") !== null
|
||||||
|
|
||||||
|
if (isFinish || row.querySelector(`th`)) {
|
||||||
|
if (stageRow) {
|
||||||
|
stageRow.querySelector("th").append(makeStatsSpan(`КП в этапе: ${stageCount}`))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinish) break
|
||||||
|
|
||||||
|
stageRow = row
|
||||||
|
stageCount = 0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fullCount++
|
||||||
|
stageCount++
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector("table tr:nth-child(2) th").append(makeStatsSpan(`Всего КП: ${fullCount}`))
|
||||||
|
|
||||||
|
addStylesToHead(`
|
||||||
|
.stats {
|
||||||
|
color: red;
|
||||||
|
margin-left: .5em;
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
changeColumnWidth()
|
changeColumnWidth()
|
||||||
hideDescription()
|
hideDescription()
|
||||||
hideStartRow()
|
hideStartRow()
|
||||||
useColspanForFinishWarning()
|
useColspanForFinishWarning()
|
||||||
|
countCp()
|
||||||
}
|
}
|
||||||
|
|
||||||
function matchNumberFromSelect(select) {
|
function matchNumberFromSelect(select) {
|
||||||
@ -2025,11 +2070,11 @@
|
|||||||
el.rows = 1
|
el.rows = 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideRedundantRows() {
|
function hideRedundantRows() {
|
||||||
document.querySelectorAll(`table tr:is(:nth-child(3), :nth-child(4), :nth-child(5))`).forEach(el => el.classList.add("hidden"))
|
document.querySelectorAll(`table tr:is(:nth-child(3), :nth-child(4), :nth-child(5))`).forEach(el => el.classList.add("hidden"))
|
||||||
}
|
}
|
||||||
|
|
||||||
makeTextareasOneRow()
|
makeTextareasOneRow()
|
||||||
hideRedundantRows()
|
hideRedundantRows()
|
||||||
createPointsInpit()
|
createPointsInpit()
|
||||||
|
Loading…
Reference in New Issue
Block a user