Fix histogramme patching: exclure annulés/reportés du graphe semaines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalid MOUTAOUAKIL 2026-04-06 23:25:36 +02:00
parent a43dd01b7e
commit c05ec932db

View File

@ -290,6 +290,7 @@ async def audit_full_patching(request: Request, db=Depends(get_db)):
patch_weekly = db.execute(text(
"SELECT last_patch_week as week, COUNT(*) as cnt FROM server_audit_full"
" WHERE status IN ('ok','partial') AND last_patch_year = 2026 AND last_patch_week IS NOT NULL"
" AND (patch_status_2026 = 'patched' OR patch_status_2026 IS NULL)"
" AND id IN (SELECT DISTINCT ON (hostname) id FROM server_audit_full WHERE status IN ('ok','partial') ORDER BY hostname, audit_date DESC)"
" GROUP BY last_patch_week ORDER BY last_patch_week"
)).fetchall()