docs: document history store helpers
This commit is contained in:
1 parent
09be5d5969
commit
9d2abde1a5
1 file changed
+2
@@ -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"))
|
||||
|
||||
Reference in new issue
Block a user