From a5b62f30a2d162c1dfdce3aa7e8db539f36b3545 Mon Sep 17 00:00:00 2001 From: Zhora Shalyapin Date: Fri, 28 Mar 2025 12:46:21 +0000 Subject: [PATCH] add counter for history --- main.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 724e84c..be0d356 100644 --- a/main.js +++ b/main.js @@ -2163,6 +2163,10 @@ let stageCount = 0 let fullPuzzleCount = 0 let stagePuzzleCount = 0 + let fullNeedHistoryCount = 0 + let stageNeedHistoryCount = 0 + let fullHistoryCount = 0 + let stageHistoryCount = 0 let stageRow = null for (const [i, row] of rows.entries()) { @@ -2174,6 +2178,8 @@ let stageHeader = stageRow.querySelector("th") stageHeader.append(makeStatsSpan(`КП в этапе: ${stageCount}`)) stageHeader.append(makeStatsSpan(`Загадок: ${stagePuzzleCount}`)) + stageHeader.append(makeStatsSpan(`Нужно ИС: ${stageNeedHistoryCount}`)) + stageHeader.append(makeStatsSpan(`ИС: ${stageHistoryCount}`)) } if (isFinish) break @@ -2181,22 +2187,41 @@ stageRow = row stageCount = 0 stagePuzzleCount = 0 + stageNeedHistoryCount = 0 + stageHistoryCount = 0 continue } + let pointNumber = getPointNumberFromCell(row.querySelector("td")) + if (!pointNumber) continue + fullCount++ stageCount++ - let pointNumber = getPointNumberFromCell(row.querySelector("td")) - if (pointNumber && points[pointNumber].is_puzzle) { + let point = points[pointNumber] + if (!point) continue + + if (point.is_puzzle) { fullPuzzleCount++ stagePuzzleCount++ } + + if (point.history_needed) { + fullNeedHistoryCount++ + stageNeedHistoryCount++ + } + + if (point.history_ru) { + fullHistoryCount++ + stageHistoryCount++ + } } let tableHeader = document.querySelector("table tr:nth-child(2) th") tableHeader.append(makeStatsSpan(`Всего КП: ${fullCount}`)) tableHeader.append(makeStatsSpan(`Загадок: ${fullPuzzleCount}`)) + tableHeader.append(makeStatsSpan(`Нужно ИС: ${fullNeedHistoryCount}`)) + tableHeader.append(makeStatsSpan(`ИС: ${fullHistoryCount}`)) addStylesToHead(` .stats {