From 5ec0b08648c6677dd278a2bb7fc31a6709bd0fa2 Mon Sep 17 00:00:00 2001 From: Dotty Dotter Date: Fri, 10 Apr 2026 22:15:13 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20normalizePartei=20als=20globale=20Funkti?= =?UTF-8?q?on=20(war=20in=20updateStats=20scoped=20=E2=86=92=20ReferenceEr?= =?UTF-8?q?ror=20in=20showDetail)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/index.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index a6c8fba..42785a0 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -891,6 +891,15 @@ } } + // Partei-Normalisierung (global, für Stats + Labels) + function normalizePartei(f) { + const u = f.toUpperCase(); + if (u === 'AFD') return 'AfD'; + if (u === 'GRÜNE' || u === 'GRUENE' || u === 'BÜNDNIS 90/DIE GRÜNEN') return 'GRÜNE'; + if (u === 'DIE LINKE') return 'LINKE'; + return f; + } + // Map code → parlament_name, vom Backend mit dem Initial-Render geliefert. // Wird im Detail-Header und im Listen-Item-Badge-Tooltip verwendet. const PARLAMENT_NAMES = {{ parlament_names | tojson }}; @@ -1109,14 +1118,7 @@ blContainer.innerHTML = ''; } - // Partei-Durchschnitte berechnen (mit Normalisierung für AfD/AFD etc.) - const normalizePartei = (f) => { - const u = f.toUpperCase(); - if (u === 'AFD') return 'AfD'; - if (u === 'GRÜNE' || u === 'GRUENE' || u === 'BÜNDNIS 90/DIE GRÜNEN') return 'GRÜNE'; - if (u === 'DIE LINKE') return 'LINKE'; - return f; - }; + // Partei-Durchschnitte berechnen (Normalisierung via globaler normalizePartei) const parteiStats = {}; allAssessments.forEach(a => { if (a.gwoeScore == null) return;