generated from coulomb/repo-seed
Add persisted Suggestion entities with WSJF ranking, relevance bumps, REST/MCP write surfaces, /suggestions dashboard page, and daily triage digest integration. Document the cluster operating model, archive the completed migration workplan, and seed WARDEN-WP-0012 routing scenarios.
17 lines
625 B
Python
17 lines
625 B
Python
from __future__ import annotations
|
|
|
|
from api.models.suggestion import Suggestion
|
|
|
|
|
|
def cost_of_delay(suggestion: Suggestion) -> float:
|
|
return suggestion.base_value + (suggestion.relevance_weight * suggestion.relevance)
|
|
|
|
|
|
def compute_wsjf(suggestion: Suggestion) -> float:
|
|
size = suggestion.job_size if suggestion.job_size > 0 else 3.0
|
|
return round(cost_of_delay(suggestion) / size, 2)
|
|
|
|
|
|
def suggestion_sort_key(suggestion: Suggestion) -> tuple[float, int, str]:
|
|
"""Higher WSJF first; tie-break on relevance then title."""
|
|
return (-compute_wsjf(suggestion), -suggestion.relevance, suggestion.title.lower()) |