fix: exclude resolved problems from new-in-24h metrics (0.9.7)
Dashboard and created_within_hours list only show open/acknowledged problems created in the last 24 hours; closed items appear under resolved only. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -82,7 +82,13 @@ def dashboard_summary(
|
||||
db.scalar(select(func.count()).select_from(Problem).where(Problem.status == "open")) or 0
|
||||
)
|
||||
problems_opened_24h = (
|
||||
db.scalar(select(func.count()).select_from(Problem).where(Problem.created_at >= since)) or 0
|
||||
db.scalar(
|
||||
select(func.count()).select_from(Problem).where(
|
||||
Problem.created_at >= since,
|
||||
Problem.status != "resolved",
|
||||
)
|
||||
)
|
||||
or 0
|
||||
)
|
||||
problems_resolved_24h = (
|
||||
db.scalar(
|
||||
|
||||
@@ -202,9 +202,9 @@ def list_problems(
|
||||
|
||||
since = datetime.now(timezone.utc) - timedelta(hours=created_within_hours)
|
||||
|
||||
stmt = stmt.where(Problem.created_at >= since)
|
||||
stmt = stmt.where(Problem.created_at >= since, Problem.status != "resolved")
|
||||
|
||||
count_stmt = count_stmt.where(Problem.created_at >= since)
|
||||
count_stmt = count_stmt.where(Problem.created_at >= since, Problem.status != "resolved")
|
||||
|
||||
if resolved_within_hours is not None:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user