Show related drafts in author cluster cards
Each cluster card now shows draft count badge and up to 5 linked draft titles with clickable links to draft detail pages. Data collected from member nodes' draft lists during cluster detection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -572,15 +572,22 @@ def get_author_network_full(db: Database) -> dict:
|
||||
|
||||
if len(component) >= 2:
|
||||
org_mix: dict[str, int] = Counter()
|
||||
cluster_drafts: dict[str, str] = {} # name -> title
|
||||
for m in component:
|
||||
org = author_info.get(m, {}).get("org", "")
|
||||
if org:
|
||||
org_mix[org] += 1
|
||||
for dn in author_info.get(m, {}).get("drafts", []):
|
||||
if dn not in cluster_drafts:
|
||||
d = db.get_draft(dn)
|
||||
cluster_drafts[dn] = d.title[:80] if d else dn
|
||||
clusters.append({
|
||||
"id": len(clusters),
|
||||
"members": component,
|
||||
"org_mix": dict(org_mix.most_common()),
|
||||
"size": len(component),
|
||||
"drafts": [{"name": n, "title": t} for n, t in list(cluster_drafts.items())[:15]],
|
||||
"draft_count": len(cluster_drafts),
|
||||
})
|
||||
|
||||
clusters.sort(key=lambda c: c["size"], reverse=True)
|
||||
|
||||
Reference in New Issue
Block a user