修改前端漏斗

This commit is contained in:
dekun
2026-05-18 11:05:32 +08:00
parent 82a7237063
commit 1d38b2c574
4 changed files with 123 additions and 8 deletions
@@ -0,0 +1,13 @@
from datetime import datetime, timedelta
from app.web import _filter_alerts_within_hours
def test_filter_alerts_within_hours_keeps_recent() -> None:
now = datetime.utcnow()
alerts = [
{"symbol": "BTC", "created_at": (now - timedelta(hours=1)).isoformat()},
{"symbol": "ETH", "created_at": (now - timedelta(hours=30)).isoformat()},
]
out = _filter_alerts_within_hours(alerts, within_hours=24.0)
assert [a["symbol"] for a in out] == ["BTC"]