fix: Matrix-Faerbung bei rating ±3 / ±4 / ±5 inkonsistent
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>
This commit is contained in:
parent
cbc303f765
commit
6e78e92ddf
@ -3,15 +3,20 @@
|
||||
|
||||
Props:
|
||||
matrix : Dict mit Schlüsseln A1–E5, je Wert ein Dict:
|
||||
{ "rating": int (-2 bis 2), "symbol": str ("++"|"+"|"○"|"−"|"−−") }
|
||||
{ "rating": int (-5 bis +5), "symbol": str ("++"|"+"|"○"|"−"|"−−") }
|
||||
Fehlende Felder werden als neutral (○) dargestellt.
|
||||
|
||||
Farbstufen-Klassen (CSS in v2.css):
|
||||
m-pp : rating 2 (++ stark fördernd) — ECG-Grün auf Weiß
|
||||
m-p : rating 1 (+ fördernd) — Grün-Tint
|
||||
m-0 : rating 0 (○ neutral) — Weiß
|
||||
m-n : rating -1 (− widersprechend) — Rot-Tint
|
||||
m-nn : rating -2 (−− stark widerspr.)— Dunkelrot
|
||||
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 %}
|
||||
@ -51,11 +56,11 @@
|
||||
} %}
|
||||
|
||||
{% macro rating_class(r) %}
|
||||
{% if r == 2 %}m-pp
|
||||
{% elif r == 1 %}m-p
|
||||
{% elif r == -1 %}m-n
|
||||
{% elif r == -2 %}m-nn
|
||||
{% else %}m-0{% endif %}
|
||||
{% 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">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user