docs: explain shared CatWar calculator helpers

This commit is contained in:
nyan404 committed 2026-08-25 04:27:37 +03:00
1 parent 7df69196c5
commit 915ac6bfb8
1 file changed
+5
+5
View File
@@ -1991,11 +1991,13 @@
}); });
} }
// Keeps the goal calculator's Russian hour label grammatically correct.
function updateHourWord() { function updateHourWord() {
const hours = sets[catId].hours; const hours = sets[catId].hours;
$('#hour-word').text(declOfNum(hours, ['час', 'часа', 'часов'])); $('#hour-word').text(declOfNum(hours, ['час', 'часа', 'часов']));
} }
// Converts an action duration descriptor into minutes for calculations.
function actLength(d) { function actLength(d) {
const minus = sets[catId].minus || 0; const minus = sets[catId].minus || 0;
if (d <= 14) return 150 - minus; if (d <= 14) return 150 - minus;
@@ -2003,6 +2005,7 @@
else return Math.ceil(150 - d / 15) - minus; else return Math.ceil(150 - d / 15) - minus;
} }
// Estimates remaining training time from progress and daily capacity.
function left(currentActivity, goal, hoursPerDay) { function left(currentActivity, goal, hoursPerDay) {
const secsPerDay = convertTime('h s', hoursPerDay); const secsPerDay = convertTime('h s', hoursPerDay);
if (actLength(currentActivity) * 4 + 1 > secsPerDay) { if (actLength(currentActivity) * 4 + 1 > secsPerDay) {
@@ -2040,6 +2043,7 @@
}; };
} }
// Recalculates and renders the visible remaining-time estimate.
function updateToact() { function updateToact() {
if (progress.stage === actStages.length - 1) { if (progress.stage === actStages.length - 1) {
$('#toact').hide(); $('#toact').hide();
@@ -2716,6 +2720,7 @@
} }
} }
/* /*
// Synchronizes the calculator with the currently selected training page.
function changeTimePage() { function changeTimePage() {
const catTimeNow = timestampToCatTime(Date.now()); const catTimeNow = timestampToCatTime(Date.now());
$(isDesctop ? '#branch' : '#site_table').append(` $(isDesctop ? '#branch' : '#site_table').append(`