add counter for history

This commit is contained in:
Zhora Shalyapin 2025-03-28 12:46:21 +00:00
parent bb0f44d4c7
commit a5b62f30a2

29
main.js
View File

@ -2163,6 +2163,10 @@
let stageCount = 0 let stageCount = 0
let fullPuzzleCount = 0 let fullPuzzleCount = 0
let stagePuzzleCount = 0 let stagePuzzleCount = 0
let fullNeedHistoryCount = 0
let stageNeedHistoryCount = 0
let fullHistoryCount = 0
let stageHistoryCount = 0
let stageRow = null let stageRow = null
for (const [i, row] of rows.entries()) { for (const [i, row] of rows.entries()) {
@ -2174,6 +2178,8 @@
let stageHeader = stageRow.querySelector("th") let stageHeader = stageRow.querySelector("th")
stageHeader.append(makeStatsSpan(`КП в этапе: ${stageCount}`)) stageHeader.append(makeStatsSpan(`КП в этапе: ${stageCount}`))
stageHeader.append(makeStatsSpan(`Загадок: ${stagePuzzleCount}`)) stageHeader.append(makeStatsSpan(`Загадок: ${stagePuzzleCount}`))
stageHeader.append(makeStatsSpan(`Нужно ИС: ${stageNeedHistoryCount}`))
stageHeader.append(makeStatsSpan(`ИС: ${stageHistoryCount}`))
} }
if (isFinish) break if (isFinish) break
@ -2181,22 +2187,41 @@
stageRow = row stageRow = row
stageCount = 0 stageCount = 0
stagePuzzleCount = 0 stagePuzzleCount = 0
stageNeedHistoryCount = 0
stageHistoryCount = 0
continue continue
} }
let pointNumber = getPointNumberFromCell(row.querySelector("td"))
if (!pointNumber) continue
fullCount++ fullCount++
stageCount++ stageCount++
let pointNumber = getPointNumberFromCell(row.querySelector("td")) let point = points[pointNumber]
if (pointNumber && points[pointNumber].is_puzzle) { if (!point) continue
if (point.is_puzzle) {
fullPuzzleCount++ fullPuzzleCount++
stagePuzzleCount++ stagePuzzleCount++
} }
if (point.history_needed) {
fullNeedHistoryCount++
stageNeedHistoryCount++
}
if (point.history_ru) {
fullHistoryCount++
stageHistoryCount++
}
} }
let tableHeader = document.querySelector("table tr:nth-child(2) th") let tableHeader = document.querySelector("table tr:nth-child(2) th")
tableHeader.append(makeStatsSpan(`Всего КП: ${fullCount}`)) tableHeader.append(makeStatsSpan(`Всего КП: ${fullCount}`))
tableHeader.append(makeStatsSpan(`Загадок: ${fullPuzzleCount}`)) tableHeader.append(makeStatsSpan(`Загадок: ${fullPuzzleCount}`))
tableHeader.append(makeStatsSpan(`Нужно ИС: ${fullNeedHistoryCount}`))
tableHeader.append(makeStatsSpan(`ИС: ${fullHistoryCount}`))
addStylesToHead(` addStylesToHead(`
.stats { .stats {