From ca4f779e484efe5d767322d5d69b65099311dfe6 Mon Sep 17 00:00:00 2001 From: Admin MPCZ Date: Wed, 15 Apr 2026 00:05:16 +0200 Subject: [PATCH] Fix audit exclusion: NULL domaine = exclu (evite audit de 690 serveurs non-tagges) --- app/routers/audit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/routers/audit.py b/app/routers/audit.py index fd017ad..1a50a5c 100644 --- a/app/routers/audit.py +++ b/app/routers/audit.py @@ -139,9 +139,10 @@ async def audit_global(request: Request, db=Depends(get_db)): # Matche sur domaine plain-text (via d.name) ou via d.code legacy # et accepte les serveurs sans domaine attribue (ne pas penaliser le NULL) if exclude_domains: + # Compare sur domaine plain-text puis fallback jointure. NULL = exclu. where.append( - "(COALESCE(s.domaine, d.name, d.code, '') NOT IN :ed " - "OR COALESCE(s.domaine, d.name, d.code, '') = '')" + "COALESCE(s.domaine, d.name, d.code) IS NOT NULL " + "AND COALESCE(s.domaine, d.name, d.code) NOT IN :ed" ) params["ed"] = tuple(exclude_domains) if exclude_zones: