feat(tasks): фильтры доски (статус/текст/дата закрытия); превью письма на всю ширину

- tasktracker/board.py: filter_tasks (текст, колонка, диапазон даты закрытия),
  window_bounds/parse_iso_date, build_board(done_from, done_to, only_column,
  filters)
- tasktracker/fragments.py: панель фильтров .bfilters + сохранение фильтров
  в переключателе «все / за 2 дня»
- /tasks и /api/tasks/board принимают q, status, done_from, done_to
- CSS: max-width превью ограничен #contacts-cols (на странице письма .c3 снова
  тянется на всю ширину)
- тесты: фильтры уровня board и HTTP; Purpose в спеке home-tasks
- openspec: changes tasks-board-filters, email-preview-full-width
This commit is contained in:
2026-11-01 12:14:23 +00:00
parent 449b7a5952
commit 337922b700
17 changed files with 442 additions and 18 deletions
+19 -4
View File
@@ -59,8 +59,22 @@ def _contacts_hint() -> list[str]:
return []
def _board(show_all_done: bool = False):
return board_mod.build_board(_tracker.list(limit=1000), show_all_done=show_all_done)
def _board(show_all_done: bool = False, *, q: str = "", status: str = "",
done_from: str = "", done_to: str = "") -> dict:
"""Доска с фильтрами: текст, колонка (статус), диапазон даты закрытия."""
filters = {
"q": (q or "").strip(),
"status": status if status in board_mod.COLUMN_KEYS else "",
"done_from": done_from if board_mod.parse_iso_date(done_from) else "",
"done_to": done_to if board_mod.parse_iso_date(done_to) else "",
}
start = board_mod.parse_iso_date(filters["done_from"])
end = board_mod.parse_iso_date(filters["done_to"])
tasks = board_mod.filter_tasks(_tracker.list(limit=1000), query=filters["q"],
column=filters["status"], done_from=start, done_to=end)
return board_mod.build_board(tasks, show_all_done=show_all_done, done_from=start,
done_to=end, only_column=filters["status"] or None,
filters=filters)
def _board_response(request: Request, show_all_done: bool = False, error: str = "", status: int = 200):
@@ -74,9 +88,10 @@ def _board_response(request: Request, show_all_done: bool = False, error: str =
@router.get("/api/tasks/board")
def tasks_board_json(all_done: int = 0):
def tasks_board_json(all_done: int = 0, q: str = "", status: str = "",
done_from: str = "", done_to: str = ""):
"""JSON доски: колонки → задачи (для будущих клиентов)."""
return _board(bool(all_done))
return _board(bool(all_done), q=q, status=status, done_from=done_from, done_to=done_to)
# --- чтение ---