feat(tasks): ответственный, пресеты, свимлейны, утренний дайджест на почту
wiki-sync / Publish docs/wiki to Gitea wiki (push) Successful in 28s
wiki-sync / Publish docs/wiki to Gitea wiki (push) Successful in 28s
- radicale: X-RESPONSIBLE/-NAME/-EMAIL, set_responsible; починена правка задач, у которых имя файла ≠ UID (кэш перечитывается при 404, _resource_url помнит href) - board: просрочка после 18:00 МСК, пресеты resp=, группировка по ответственному - tasktracker: правило «вне бэклога только с ответственным», set_responsible - UI доски: бейдж/поповер ответственного, пресеты, переключатель «По ответственным» - контакты: is_employee (звёздочка, пресет «Сотрудники»), 9 сотрудников отмечены, Жигульский/Ферулёв/Чикуров созданы заготовками - scripts/backfill_responsible.py: владелец проставлен 73 задачам - scripts/tasks_digest.py + cron 08:00 daily: письмо с разделами, himalaya -a hermes - tests: test_task_responsible.py (15), test_tasks_digest.py (6) - openspec changes task-responsible и tasks-digest заархивированы
This commit is contained in:
+33
-7
@@ -433,10 +433,12 @@ def contacts_page(request: Request, _: AuthDep, q: str = "", company: str = "",
|
||||
last_name: str = "", first_name: str = "", middle_name: str = "",
|
||||
phone: str = "", email: str = "", position: str = "",
|
||||
letter: str = DEFAULT_LETTER, page: int = 1, per_page: int = 50,
|
||||
sort: str = "last_name", dir: str = "asc", cid: str = ""):
|
||||
sort: str = "last_name", dir: str = "asc", cid: str = "",
|
||||
emp: str = ""):
|
||||
"""Страница контактов: фильтры + алфавит (c1), таблица с пагинацией (c2), карточка (c3).
|
||||
|
||||
По умолчанию открывается буква «А»; `letter=all` — весь список.
|
||||
По умолчанию открывается буква «А»; `letter=all` — весь список;
|
||||
`emp=1` — пресет «Сотрудники».
|
||||
"""
|
||||
import math
|
||||
db_all = contacts.load()
|
||||
@@ -446,10 +448,10 @@ def contacts_page(request: Request, _: AuthDep, q: str = "", company: str = "",
|
||||
"phone": phone, "email": email, "position": position}
|
||||
# "all"/"все" — без фильтра по букве; иначе буква из указателя
|
||||
letter_eff = "" if (letter or "").strip().lower() in ("all", "все") else (letter or "").strip()
|
||||
found = contacts.search(everyone, letter=letter_eff, **filters)
|
||||
found = contacts.search(everyone, letter=letter_eff, emp=emp, **filters)
|
||||
found = contacts.sort_contacts(found, sort, reverse=(dir == "desc"))
|
||||
# алфавит считается без учёта запроса q и выбранной буквы — иначе «прыгает»
|
||||
alpha_source = contacts.search(everyone, **{**filters, "q": ""})
|
||||
alpha_source = contacts.search(everyone, emp=emp, **{**filters, "q": ""})
|
||||
|
||||
per_page = per_page if per_page in PER_PAGE_OPTIONS else 50
|
||||
pages = max(1, math.ceil(len(found) / per_page))
|
||||
@@ -458,6 +460,8 @@ def contacts_page(request: Request, _: AuthDep, q: str = "", company: str = "",
|
||||
|
||||
letter_q = letter_eff or "all"
|
||||
params = {k: v for k, v in {**filters, "letter": letter_q}.items() if v}
|
||||
if emp:
|
||||
params["emp"] = emp
|
||||
if sort != "last_name":
|
||||
params["sort"] = sort
|
||||
if dir != "asc":
|
||||
@@ -473,6 +477,7 @@ def contacts_page(request: Request, _: AuthDep, q: str = "", company: str = "",
|
||||
"companies": contacts.filter_options(everyone, "company"),
|
||||
"positions": contacts.filter_options(everyone, "position"),
|
||||
"sort": sort, "dir": dir, "letter": letter_eff, "filters": filters,
|
||||
"emp": emp,
|
||||
"page": "contacts", # подсветка раздела в боковой панели
|
||||
}
|
||||
if cid:
|
||||
@@ -529,6 +534,26 @@ async def contact_field(contact_id: str, request: Request, _: AuthDep):
|
||||
return out
|
||||
|
||||
|
||||
@app.post("/api/contact/{contact_id}/employee")
|
||||
async def contact_employee(contact_id: str, request: Request, _: AuthDep):
|
||||
"""Включить/выключить признак «сотрудник»: {"value": true|false}."""
|
||||
import json
|
||||
|
||||
try:
|
||||
data = json.loads(await request.body() or b"{}")
|
||||
except json.JSONDecodeError:
|
||||
raise HTTPException(status_code=400, detail="invalid JSON") from None
|
||||
value = data.get("value")
|
||||
if value is None:
|
||||
current = contacts.by_id(contact_id) or {}
|
||||
value = not current.get("is_employee")
|
||||
res = contacts.set_employee(contact_id, bool(value))
|
||||
if res.get("error"):
|
||||
status = 404 if "не найден" in str(res["error"]) else 400
|
||||
return JSONResponse({"error": res["error"]}, status_code=status)
|
||||
return {"ok": True, "is_employee": res["is_employee"]}
|
||||
|
||||
|
||||
# --- Автосозданные сущности письма (событие/задача) ---
|
||||
@app.post("/api/email/entity")
|
||||
async def email_entity(request: Request, _: AuthDep):
|
||||
@@ -579,12 +604,13 @@ async def email_entity(request: Request, _: AuthDep):
|
||||
|
||||
@app.get("/tasks", response_class=HTMLResponse)
|
||||
def tasks_page(request: Request, _: AuthDep, all_done: int = 0, q: str = "",
|
||||
status: str = "", done_from: str = "", done_to: str = ""):
|
||||
"""Доска задач (канбан): форма создания, фильтры (текст/статус/дата закрытия)."""
|
||||
status: str = "", done_from: str = "", done_to: str = "",
|
||||
resp: str = "", view: str = ""):
|
||||
"""Доска задач (канбан): форма создания, фильтры, пресеты, вид по ответственным."""
|
||||
from tasktracker.api import _board, _contacts_hint
|
||||
|
||||
data = _board(show_all_done=bool(all_done), q=q, status=status,
|
||||
done_from=done_from, done_to=done_to)
|
||||
done_from=done_from, done_to=done_to, resp=resp, view=view)
|
||||
if is_htmx(request):
|
||||
return HTMLResponse(tfrag.board_html(data, _contacts_hint()))
|
||||
return render(request, "tasks.html", {
|
||||
|
||||
Reference in New Issue
Block a user