initial commit

This commit is contained in:
parovin committed 2026-10-11 14:12:10 +03:00
commit 39fdd43d8e
127 files changed
+13919

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
from __future__ import annotations
from app.config import settings
# Шаг корректировки/ввода веса вспомогательных (прибавка и снижение).
ACCESSORY_STEP_KG = 0.5
def weight_step_for(exercise_name: str | None = None, *, kind: str | None = None) -> float:
"""Жим — блины (config). Вспомогательные — 0.5 кг."""
if kind == "bench" or (exercise_name == "Жим"):
return settings.plate_step_kg
if kind in ("accessory", "failure"):
return ACCESSORY_STEP_KG
if exercise_name:
return ACCESSORY_STEP_KG
return settings.plate_step_kg
def round_to_plate(weight_kg: float, step: float | None = None) -> float:
step = step if step is not None else settings.plate_step_kg
if weight_kg <= 0:
return 0.0
return round(round(weight_kg / step) * step, 2)
def round_exercise_weight(weight_kg: float, exercise_name: str, *, kind: str | None = None) -> float:
return round_to_plate(weight_kg, weight_step_for(exercise_name, kind=kind))
def bench_weight(one_rm_kg: float, percent: float) -> float:
"""Жим: округление как раньше — по plate_step_kg (1.25)."""
return round_to_plate(one_rm_kg * (percent / 100.0), settings.plate_step_kg)