diff --git a/app/belki/history.py b/app/belki/history.py index bcbffc3..24eb7ff 100644 --- a/app/belki/history.py +++ b/app/belki/history.py @@ -43,6 +43,7 @@ class CalculationStore: @classmethod def from_environment(cls) -> "CalculationStore": + """Создаёт хранилище, выбрав PostgreSQL или SQLite по окружению.""" return cls( database_url=os.getenv("BELKI_DATABASE_URL"), sqlite_path=os.getenv("BELKI_HISTORY_DB", "data/belki.sqlite3"), @@ -155,6 +156,7 @@ class CalculationStore: if sort_by not in {"escort_id", "escort_name", "kitten_id", "kitten_name"}: sort_by = "escort_id" def sort_value(item: dict[str, Any]) -> tuple[bool, int, int | str]: + """Строит ключ, который сортирует числовые и текстовые значения предсказуемо.""" data = item["input"] if sort_by == "escort_id": value = data.get("escort_id", data.get("character_id"))