Fix: normalizePartei als globale Funktion (war in updateStats scoped → ReferenceError in showDetail)

This commit is contained in:
Dotty Dotter 2026-04-10 22:15:13 +02:00
parent b851173e6d
commit 5ec0b08648

View File

@ -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;