From 915ac6bfb8322e9832a146338b67fa5e139a6a1d Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Tue, 25 Aug 2026 04:27:37 +0300 Subject: [PATCH] docs: explain shared CatWar calculator helpers --- web/data/catwarmod-core.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/data/catwarmod-core.js b/web/data/catwarmod-core.js index e64f813..58a1411 100644 --- a/web/data/catwarmod-core.js +++ b/web/data/catwarmod-core.js @@ -1991,11 +1991,13 @@ }); } + // Keeps the goal calculator's Russian hour label grammatically correct. function updateHourWord() { const hours = sets[catId].hours; $('#hour-word').text(declOfNum(hours, ['час', 'часа', 'часов'])); } + // Converts an action duration descriptor into minutes for calculations. function actLength(d) { const minus = sets[catId].minus || 0; if (d <= 14) return 150 - minus; @@ -2003,6 +2005,7 @@ else return Math.ceil(150 - d / 15) - minus; } + // Estimates remaining training time from progress and daily capacity. function left(currentActivity, goal, hoursPerDay) { const secsPerDay = convertTime('h s', hoursPerDay); if (actLength(currentActivity) * 4 + 1 > secsPerDay) { @@ -2040,6 +2043,7 @@ }; } + // Recalculates and renders the visible remaining-time estimate. function updateToact() { if (progress.stage === actStages.length - 1) { $('#toact').hide(); @@ -2716,6 +2720,7 @@ } } /* + // Synchronizes the calculator with the currently selected training page. function changeTimePage() { const catTimeNow = timestampToCatTime(Date.now()); $(isDesctop ? '#branch' : '#site_table').append(`