User-Bug-Report: "+ mal blassrot, ++ mal blassgruen oder gruen".
Ursache: matrix_mini-Macro hatte rating_class() nur fuer
rating ∈ {-2, -1, 0, 1, 2} definiert. Aber die echte
Bewertungs-Skala ist −5..+5 (siehe app/models.py:MatrixEntry).
Effekt:
- rating=3, symbol="+" → m-0 neutral angezeigt (sollte m-p gruen sein)
- rating=4, symbol="++" → m-0 neutral (sollte m-pp ECG-Gruen)
- rating=-3, symbol="−" → m-0 neutral (sollte m-n rot)
- rating=-4, symbol="−−" → m-0 neutral (sollte m-nn dunkelrot)
Fix: rating_class abdeckt jetzt die volle Skala −5..+5 analog
zu MatrixEntry.to_symbol():
- rating ≥ 4 → m-pp
- rating 1..3 → m-p
- rating 0 → m-0
- rating -1..-3→ m-n
- rating ≤ -4 → m-nn
Doku im Macro-Header korrigiert (war "-2 bis 2", jetzt "-5 bis +5").
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
101 lines
4.3 KiB
HTML
101 lines
4.3 KiB
HTML
{#
|
||
matrix_mini.html — GWÖ-Matrix 5×5 Minidarstellung
|
||
|
||
Props:
|
||
matrix : Dict mit Schlüsseln A1–E5, je Wert ein Dict:
|
||
{ "rating": int (-5 bis +5), "symbol": str ("++"|"+"|"○"|"−"|"−−") }
|
||
Fehlende Felder werden als neutral (○) dargestellt.
|
||
|
||
Mapping rating → Symbol → Farbklasse (vgl. models.py:MatrixEntry.to_symbol):
|
||
rating ≥ 4 → "++" → m-pp (ECG-Grün)
|
||
rating 1..3 → "+" → m-p (Grün-Tint)
|
||
rating 0 → "○" → m-0 (Weiß)
|
||
rating -1..-3→ "−" → m-n (Rot-Tint)
|
||
rating ≤ -4 → "−−" → m-nn (Dunkelrot)
|
||
|
||
Vorher (Bug): Macro mappte nur rating ∈ {-2,-1,0,1,2}, was bei
|
||
rating ∈ {3,4,-3,-4,-5} zu inkonsistenter Faerbung fuehrte —
|
||
z.B. "+" mit rating=3 → m-0 neutral statt m-p gruen.
|
||
Jetzt: Mapping deckt die volle Skala −5..+5 ab.
|
||
|
||
Verwendung:
|
||
{% from "v2/components/matrix_mini.html" import matrix_mini %}
|
||
{{ matrix_mini(assessment.matrix) }}
|
||
#}
|
||
|
||
{% macro matrix_mini(matrix) %}
|
||
{% set rows = ["A", "B", "C", "D", "E"] %}
|
||
{% set cols = ["1", "2", "3", "4", "5"] %}
|
||
{% set row_labels = {
|
||
"A": "A · Lieferant:innen",
|
||
"B": "B · Finanzen",
|
||
"C": "C · Verwaltung",
|
||
"D": "D · Bürger:innen",
|
||
"E": "E · Gesellschaft & Natur"
|
||
} %}
|
||
{% set row_titles = {
|
||
"A": "Berührungsgruppe A — Lieferant:innen, ausgelagerte Betriebe, Dienstleister:innen. Externe Beschaffung und Lieferketten der Kommune.",
|
||
"B": "Berührungsgruppe B — Finanzpartner:innen, Geldgeber:innen, Steuerzahler:innen. Umgang mit öffentlichen Mitteln und Haushalt.",
|
||
"C": "Berührungsgruppe C — Politische Führung, Verwaltung, Ehrenamtliche. Mandatsträger:innen und Mitarbeitende der Kommune.",
|
||
"D": "Berührungsgruppe D — Bürger:innen und Wirtschaft. Wirkung innerhalb der Gemeindegrenzen, Daseinsvorsorge.",
|
||
"E": "Berührungsgruppe E — Staat, Gesellschaft und Natur. Wirkung über die Gemeindegrenzen hinaus, Zukunft."
|
||
} %}
|
||
{% set col_labels = {
|
||
"1": "Menschenwürde",
|
||
"2": "Solidarität",
|
||
"3": "Ökol. Nachhaltigkeit",
|
||
"4": "Soz. Gerechtigkeit",
|
||
"5": "Transparenz"
|
||
} %}
|
||
{% set col_titles = {
|
||
"1": "Wert 1 — Menschenwürde (Rechtsstaatsprinzip): Werden Grundrechte geschützt? Rechtliche Gleichstellung, Schutz vor Diskriminierung.",
|
||
"2": "Wert 2 — Solidarität (Gemeinnutz): Wird das Gemeinwohl gefördert? Mehrwert für die Gemeinschaft, Kooperation statt Konkurrenz.",
|
||
"3": "Wert 3 — Ökologische Nachhaltigkeit (Umwelt-Verantwortung): Klimaschutz, Ressourcenschonung, Biodiversität, Kreislaufwirtschaft.",
|
||
"4": "Wert 4 — Soziale Gerechtigkeit (Sozialstaatsprinzip): Gerechte Verteilung, Daseinsvorsorge, soziale Absicherung, Chancengleichheit.",
|
||
"5": "Wert 5 — Transparenz & Mitbestimmung (Demokratie): Bürgerbeteiligung, Offenlegung, demokratische Prozesse, Rechenschaftspflicht."
|
||
} %}
|
||
|
||
{% macro rating_class(r) %}
|
||
{% if r is none or r == 0 %}m-0
|
||
{% elif r >= 4 %}m-pp
|
||
{% elif r >= 1 %}m-p
|
||
{% elif r <= -4 %}m-nn
|
||
{% else %}m-n{% endif %}
|
||
{% endmacro %}
|
||
|
||
<div class="v2-matrix-mini" role="table" aria-label="GWÖ-Matrix 5×5">
|
||
{# Header-Zeile #}
|
||
<div class="hdr" role="columnheader"></div>
|
||
{% for c in cols %}
|
||
<div class="hdr" role="columnheader" title="{{ col_titles[c] }}">{{ col_labels[c] }}</div>
|
||
{% endfor %}
|
||
|
||
{# Daten-Zeilen #}
|
||
{% for r in rows %}
|
||
<div class="rhdr" role="rowheader" title="{{ row_titles[r] }}">{{ row_labels[r] }}</div>
|
||
{% for c in cols %}
|
||
{% set key = r ~ c %}
|
||
{% set cell = matrix[key] if matrix is defined and key in matrix else {} %}
|
||
{% set rating = cell.rating | default(0) | int %}
|
||
{% set symbol = cell.symbol | default("○") %}
|
||
<div class="{{ rating_class(rating) | trim }}"
|
||
role="cell"
|
||
title="{{ key }}: {{ symbol }}"
|
||
aria-label="{{ key }}, {{ symbol }}, {% if rating == 2 %}stark fördernd{% elif rating == 1 %}fördernd{% elif rating == 0 %}neutral{% elif rating == -1 %}widersprechend{% else %}stark widersprechend{% endif %}"
|
||
onclick="if(typeof v2ShowMatrixFieldInfo==='function')v2ShowMatrixFieldInfo('{{ key }}')"
|
||
style="cursor:pointer;">
|
||
{{ symbol }}
|
||
</div>
|
||
{% endfor %}
|
||
{% endfor %}
|
||
</div>
|
||
|
||
<div class="v2-matrix-legend" aria-hidden="true">
|
||
<span>++ stark fördernd</span>
|
||
<span>+ fördernd</span>
|
||
<span>○ neutral</span>
|
||
<span>− widersprechend</span>
|
||
<span>−− stark widerspr.</span>
|
||
</div>
|
||
{% endmacro %}
|