feat(awooop): show source ref gap recency
This commit is contained in:
@@ -501,7 +501,10 @@ async def _fetch_callback_reply_audit_summary(
|
||||
SELECT jsonb_agg(
|
||||
jsonb_build_object(
|
||||
'prefix', prefix,
|
||||
'total', total
|
||||
'total', total,
|
||||
'recent_24h_total', recent_24h_total,
|
||||
'first_sent_at', first_sent_at,
|
||||
'last_sent_at', last_sent_at
|
||||
)
|
||||
ORDER BY total DESC, prefix ASC
|
||||
)
|
||||
@@ -515,7 +518,13 @@ async def _fetch_callback_reply_audit_summary(
|
||||
),
|
||||
'unknown'
|
||||
) AS prefix,
|
||||
COUNT(*) AS total
|
||||
COUNT(*) AS total,
|
||||
COUNT(*) FILTER (
|
||||
WHERE COALESCE(sent_at, queued_at)
|
||||
>= NOW() - INTERVAL '24 hours'
|
||||
) AS recent_24h_total,
|
||||
MIN(COALESCE(sent_at, queued_at)) AS first_sent_at,
|
||||
MAX(COALESCE(sent_at, queued_at)) AS last_sent_at
|
||||
FROM awooop_outbound_message
|
||||
WHERE project_id = :project_id
|
||||
AND channel_type = 'telegram'
|
||||
@@ -693,6 +702,9 @@ def _reply_markup_gap_prefixes_from_value(value: Any) -> list[dict[str, Any]]:
|
||||
prefixes.append({
|
||||
"prefix": prefix[:80],
|
||||
"total": _safe_int(item.get("total")),
|
||||
"recent_24h_total": _safe_int(item.get("recent_24h_total")),
|
||||
"first_sent_at": item.get("first_sent_at"),
|
||||
"last_sent_at": item.get("last_sent_at"),
|
||||
})
|
||||
if len(prefixes) >= 5:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user