diff --git a/backend-compliance/compliance/services/dsi_document_checker.py b/backend-compliance/compliance/services/dsi_document_checker.py index fc792b8..4a90806 100644 --- a/backend-compliance/compliance/services/dsi_document_checker.py +++ b/backend-compliance/compliance/services/dsi_document_checker.py @@ -208,21 +208,20 @@ def check_document_completeness( else: present += 1 - # Add summary finding + # Always add summary finding (even at 100% — needed for completeness tracking) if total > 0: pct = round(present / total * 100) - if pct < 100: - findings.insert(0, { - "code": f"DSI-SCORE-{doc_type.upper()}", - "severity": "LOW" if pct >= 80 else "MEDIUM" if pct >= 50 else "HIGH", - "text": ( - f"'{doc_title}': {present}/{total} Pflichtangaben vorhanden ({pct}%). " - f"Fehlend: {total - present} Angaben nach {label}." - ), - "doc_title": doc_title, - "doc_url": doc_url, - "doc_type": doc_type, - }) + findings.insert(0, { + "code": f"DSI-SCORE-{doc_type.upper()}", + "severity": "OK" if pct == 100 else "LOW" if pct >= 80 else "MEDIUM" if pct >= 50 else "HIGH", + "text": ( + f"'{doc_title}': {present}/{total} Pflichtangaben vorhanden ({pct}%)." + + (f" Fehlend: {total - present} Angaben nach {label}." if pct < 100 else "") + ), + "doc_title": doc_title, + "doc_url": doc_url, + "doc_type": doc_type, + }) return findings