diff --git a/app/main.py b/app/main.py index bcc103d..947cc3f 100644 --- a/app/main.py +++ b/app/main.py @@ -675,7 +675,11 @@ def _row_to_detail(row): "link": row.get("link") or "", "konfidenz": row.get("konfidenz") or "", "fehlende_programme": row.get("fehlende_programme") or [], + # ``wahlperiode``: Filter-Key wie "NRW-WP18" — wird in den Auswertungs- + # Filtern als Stable-Key benutzt. ``wahlperiode_zahl``: nur die Zahl + # (z.B. 18) für die Anzeige im Antrag-Detail. "wahlperiode": _wahlperiode_silent(row.get("datum", ""), row.get("bundesland", "")), + "wahlperiode_zahl": _wahlperiode_zahl_silent(row.get("datum", ""), row.get("bundesland", "")), # Roher ISO-Zeitstempel für OG-Cache-Key (#141) "updated_at_raw": row.get("updated_at", ""), } @@ -691,6 +695,26 @@ def _wahlperiode_silent(datum: str, bundesland: str) -> str: return "" +def _wahlperiode_zahl_silent(datum: str, bundesland: str) -> Optional[int]: + """Wahlperiode als Zahl (z.B. 18) für die Anzeige. ``None`` wenn unklar. + + ``wahlperiode_for`` liefert ``"-WP"`` als Filter-Key — extrahieren + wir hier die N-Komponente, damit das Template "18. Wahlperiode" zeigen + kann statt "NRW-WP18. Wahlperiode". + """ + raw = _wahlperiode_silent(datum, bundesland) + if not raw: + return None + import re + m = re.search(r"WP(\d+)", raw) + if m: + try: + return int(m.group(1)) + except ValueError: + return None + return None + + @app.post("/analyze") @limiter.limit("10/minute") async def start_analysis( diff --git a/app/templates/v2/screens/merkliste.html b/app/templates/v2/screens/merkliste.html index 9acb561..a79f235 100644 --- a/app/templates/v2/screens/merkliste.html +++ b/app/templates/v2/screens/merkliste.html @@ -226,7 +226,10 @@ function showToast(msg) { } function renderRow(a) { - var score = (typeof a.gwoe_score === 'number') ? a.gwoe_score.toFixed(1) : '—'; + // /api/assessment liefert gwoeScore (camelCase), nicht gwoe_score. + var score = (typeof a.gwoeScore === 'number') ? a.gwoeScore.toFixed(1) + : (typeof a.gwoe_score === 'number') ? a.gwoe_score.toFixed(1) + : '—'; var bl = a.bundesland || ''; var fraktion = (a.fraktionen || []).join(', '); var title = a.title || a.titel || a.drucksache; diff --git a/app/templates/v3/screens/antrag_detail.html b/app/templates/v3/screens/antrag_detail.html index 8e1ff60..7ccdab3 100644 --- a/app/templates/v3/screens/antrag_detail.html +++ b/app/templates/v3/screens/antrag_detail.html @@ -49,20 +49,23 @@ {# 1 ── Metadaten + Titel ─────────────────────────────────────────── #}
+ {# Whitespace-Steuerung: alle Jinja-Tags auf einer Zeile, sonst entstehen + Newlines die der Browser als Spaces rendert ("13.04.2026 , qwen-plus" + statt "13.04.2026, qwen-plus"). #}
- {{ antrag.bundesland | default("") }} - {% if antrag.drucksache %} · Drs. {{ antrag.drucksache }}{% endif %} - {% if antrag.typ %} · {{ antrag.typ }}{% endif %} - {% if antrag.wahlperiode %} · {{ antrag.wahlperiode }}. Wahlperiode{% endif %} - {% if antrag.datum %} · eingebracht {{ antrag.datum }}{% endif %} + {{- antrag.bundesland | default("") -}} + {%- if antrag.drucksache %} · Drs. {{ antrag.drucksache }}{% endif -%} + {%- if antrag.typ %} · {{ antrag.typ }}{% endif -%} + {%- if antrag.wahlperiode_zahl %} · {{ antrag.wahlperiode_zahl }}. Wahlperiode{% elif antrag.wahlperiode %} · {{ antrag.wahlperiode }}. Wahlperiode{% endif -%} + {%- if antrag.datum %} · eingebracht {{ antrag.datum }}{% endif -%}

{{ antrag.title | default("Antrag") }}

{% if antrag.parteien or antrag.analysiert %} {% endif %} {% if antrag.themen %}