feat(dashboard): supporting schema, seed, catalog links, funnel/PM labels and API contract (merge resolution)

This commit is contained in:
fatemeh sane
2026-10-08 11:18:57 +03:30
parent b82c039265
commit 7bb432e715
13 changed files with 817 additions and 18 deletions
+16
View File
@@ -1100,6 +1100,17 @@ async def quote_stats(
*conditions,
)
)
# Procurement funnel (cumulative, not the current-state counts above):
# a quote counts as accepted/arrived if it EVER reached that stage.
funnel_row = (
await db.execute(
select(
func.count().label("offered_total"),
func.count().filter(Quote.accepted_date.is_not(None)).label("accepted_total"),
func.count().filter(Quote.arrived_date.is_not(None)).label("arrived_total"),
).where(*conditions)
)
).one()
return {
"total": sum(counts.values()),
"offered": counts["offered"],
@@ -1108,6 +1119,11 @@ async def quote_stats(
"rejected": counts["rejected"],
"expired": counts["expired"],
"average_lead_time_days": int(round(float(avg))) if avg is not None else None,
"funnel": {
"offered_total": funnel_row.offered_total,
"accepted_total": funnel_row.accepted_total,
"arrived_total": funnel_row.arrived_total,
},
}