mirror of
https://gitverse.ru/kpa39l/vesti.git
synced 2026-09-29 09:55:03 +00:00
fix(web): статус группы при группировке по дате + published-страница
- _fetch_candidates: статус группы = доминирующий (new>rejected>published), а не первого поста → при group_by=date группа «Ранее на этой неделе» больше не выглядит опубликованной (openchange fix-date-group-status) - base.html: padding-top 1.5rem→4.5rem — заголовок не перекрывается fixed-top меню - published.html: ID поста на карточках (#N · направление) - AGENT.MD: бэкапы автоматические по крону, вручную не запускать
This commit is contained in:
+12
-1
@@ -216,13 +216,24 @@ def _fetch_candidates(conn, direction: str, status: str, own: str, q: str, group
|
||||
|
||||
keyf = {"source": _key_source, "date": _key_date, "status": _key_status}[group_by]
|
||||
|
||||
def _group_status(items):
|
||||
"""Статус группы: приоритет new > rejected > published, иначе — первый.
|
||||
При группировке по дате первый пост группы — свежайший и может быть
|
||||
published/rejected, хотя вся группа — новые кандидаты; статус группы
|
||||
должен отражать состав, а не первый пост."""
|
||||
st = [p["status"] for p in items]
|
||||
for s in ("new", "rejected", "published"):
|
||||
if s in st:
|
||||
return s
|
||||
return items[0]["status"]
|
||||
|
||||
grouped = []
|
||||
for k, it in itertools.groupby(sorted(flat, key=keyf), key=keyf):
|
||||
items = list(it)
|
||||
grouped.append({
|
||||
"key": k,
|
||||
"label": _group_label(group_by, k),
|
||||
"status": items[0]["status"],
|
||||
"status": _group_status(items),
|
||||
"posts": items,
|
||||
})
|
||||
# порядок групп: new → rejected → published (для status), иначе по ключу
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>VESTI — {% block title %}Управление{% endblock %}</title>
|
||||
<link href="/static/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body { padding-top: 1.5rem; background: #f5f6fa; }
|
||||
body { padding-top: 4.5rem; background: #f5f6fa; }
|
||||
.card { box-shadow: 0 1px 4px rgba(0,0,0,.08); }
|
||||
.post-text { white-space: pre-wrap; max-height: 140px; overflow-y: auto; font-size: .9rem; }
|
||||
</style>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="badge bg-secondary">{{ p.direction or '?' }}</span>
|
||||
<span class="badge bg-secondary">#{{ p.id }} · {{ p.direction or '?' }}</span>
|
||||
<small class="text-muted">{{ p.source_name }} · {{ p.published_at | dt }}</small>
|
||||
</div>
|
||||
<div class="post-text mt-2">{{ (p.summary or p.text or '')[:2000] | markdown }}</div>
|
||||
|
||||
Reference in New Issue
Block a user