AP1.8a: Portfolio-Rang im Cockpit mit Reorder und Next-Action-Sortierung.
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 2m21s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 21s
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 2m21s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 21s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d7aefed0de
commit
a19c6abd26
16 files changed
+426
-34
No files matched your search
@@ -0,0 +1 @@
|
||||
"""Portfolio steering helpers."""
|
||||
@@ -0,0 +1,39 @@
|
||||
"""Portfolio-Priorität — Sortierung für Next Action (AP1.8a)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
|
||||
def portfolio_rank_sort_key(
|
||||
initiative_id: Optional[str],
|
||||
rank_map: dict[str, Optional[int]],
|
||||
) -> tuple[int, str]:
|
||||
"""Niedrigerer Rank = höhere Priorität; NULL ans Ende."""
|
||||
if not initiative_id:
|
||||
return (1_000_000, "")
|
||||
rank = rank_map.get(initiative_id)
|
||||
if rank is None:
|
||||
return (999_999, initiative_id)
|
||||
return (rank, initiative_id)
|
||||
|
||||
|
||||
def sort_candidates_by_portfolio_rank(
|
||||
candidates: list[dict[str, Any]],
|
||||
rank_map: dict[str, Optional[int]],
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Sortiert Next-Action-Kandidaten nach Portfolio-Rang."""
|
||||
enriched = []
|
||||
for candidate in candidates:
|
||||
item = dict(candidate)
|
||||
initiative_id = item.get("initiative_id")
|
||||
if initiative_id:
|
||||
item["portfolio_rank"] = rank_map.get(str(initiative_id))
|
||||
enriched.append(item)
|
||||
enriched.sort(
|
||||
key=lambda c: portfolio_rank_sort_key(
|
||||
str(c["initiative_id"]) if c.get("initiative_id") else None,
|
||||
rank_map,
|
||||
)
|
||||
)
|
||||
return enriched
|
||||
Reference in new issue
Block a user