docs: explain CatWar goal calculator helpers

This commit is contained in:
nyan404 committed 2026-08-25 04:26:33 +03:00
1 parent c4f8648866
commit 58ef9f6ae2
1 file changed
+5
+5
View File
@@ -2007,11 +2007,13 @@ function activityCalc(catId) {
}); });
} }
// 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 goal 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;
@@ -2019,6 +2021,7 @@ function activityCalc(catId) {
else return Math.ceil(150 - d / 15) - minus; else return Math.ceil(150 - d / 15) - minus;
} }
// Estimates remaining training time from current 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) {
@@ -2056,6 +2059,7 @@ function activityCalc(catId) {
}; };
} }
// 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();
@@ -2732,6 +2736,7 @@ function getSavedLsById(lsId) {
} }
} }
/* /*
// 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(`