diff --git a/app/report.py b/app/report.py index 2f99288..59b4839 100644 --- a/app/report.py +++ b/app/report.py @@ -44,16 +44,32 @@ def get_score_color(score: float) -> str: def get_rating_symbol(rating: int) -> str: - """Convert numeric rating to symbol.""" - if rating >= 2: + """Convert numeric rating to symbol — gleiche Logik wie in models.py + und v2/components/matrix_mini.html. Skala -5..+5.""" + if rating >= 4: return "++" - if rating == 1: + if rating >= 1: return "+" if rating == 0: return "○" - if rating == -1: - return "−" - return "−−" + if rating <= -4: + return "−−" + return "−" + + +def get_rating_class(rating: int) -> str: + """5-Klassen-Coloring analog zu v2 matrix_mini (m-pp/m-p/m-0/m-n/m-nn) + — vorher hatte das PDF nur 3 Klassen (positive/negative/neutral), + was zu 'gleichfarbig' für + und ++ führte.""" + if rating >= 4: + return "rating-pp" + if rating >= 1: + return "rating-p" + if rating == 0: + return "rating-0" + if rating <= -4: + return "rating-nn" + return "rating-n" def format_redline_html(text: str) -> str: @@ -102,13 +118,13 @@ def build_matrix_html(assessment: Assessment) -> str: entry = rating_map.get(field) if entry: symbol = get_rating_symbol(entry.rating) - css_class = "positive" if entry.rating > 0 else ("negative" if entry.rating < 0 else "neutral") + css_class = get_rating_class(entry.rating) # entry.aspect comes from the LLM and is interpolated into a # title="..." attribute — escape it so a stray double-quote # cannot break out and inject attributes/handlers. html.append(f'