feat(cookie): 2. Sicht Banner-Kategorie + Fehl-Einsortierung

CookieResultView bekommt einen Umschalter [Rechtliche Rolle] ↔
[Banner-Kategorie] (Notwendig/Funktional/Statistik/Marketing). In beiden
Sichten zeigt jede Cookie-Zeile '→ sollte: Marketing', wenn die tatsächliche
Kategorie laut Library von der deklarierten abweicht (rot bei Tracker als
notwendig, § 25 TDDDG). Neue KPI 'Falsch einsortiert'. Backend liefert dazu
cookie_categories (name→actual_category) aus big_lib im cookie-check-Output;
Seite lädt cookie-check einmal und reicht es an beide Komponenten.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-11 10:33:33 +02:00
parent af8906b156
commit b0115cb10b
6 changed files with 201 additions and 45 deletions
@@ -125,6 +125,9 @@ def analyze_cookies(vendors: list[dict], big_lib: dict | None = None) -> dict:
in_library = 0
seen_third: set[str] = set()
seen_alt: set[str] = set()
# name_lower → tatsächliche Kategorie laut Library (für die Banner-Sicht:
# zeigt, wo ein Cookie eigentlich hingehört, falls falsch einsortiert).
cookie_cats: dict[str, str] = {}
for v in vendors or []:
vcat = (v.get("category") or "").lower()
@@ -149,6 +152,8 @@ def analyze_cookies(vendors: list[dict], big_lib: dict | None = None) -> dict:
})
rich = lookup_cookie(name) or {}
big = big_lib.get(name.lower(), {})
if big.get("actual_category"):
cookie_cats[name.lower()] = big["actual_category"]
if not rich and not big:
continue
in_library += 1
@@ -268,4 +273,5 @@ def analyze_cookies(vendors: list[dict], big_lib: dict | None = None) -> dict:
"findings": len(findings),
},
"findings": findings,
"cookie_categories": cookie_cats,
}