fix: complete catalog pagination and recovery states

This commit is contained in:
2026-09-11 11:25:59 +03:00
parent 78493b9248
commit a82930027d
13 changed files with 296 additions and 52 deletions

View File

@@ -132,6 +132,8 @@ def list_employees_page(
has_academic_degree=has_academic_degree,
)
total = db.scalar(select(func.count()).select_from(base_stmt.subquery())) or 0
if offset >= total:
offset = 0
sort_column = EMPLOYEE_SORTS.get(sort, Employee.full_name)
order = desc(sort_column) if direction == "desc" else sort_column
employees = db.scalars(base_stmt.order_by(order).limit(limit).offset(offset)).all()