refactor: align tipp colors with legacy and drop goal difference category

Co-authored-by: aider (anthropic/claude-opus-5-5) <aider@aider.chat>
This commit is contained in:
torsten 2026-10-04 21:00:54 +02:00
parent 7ecd38cb20
commit 36c356b69c
2 changed files with 17 additions and 33 deletions

View file

@ -80,38 +80,26 @@ class Tipp {
}
/**
* Gibt die CSS-Klasse für die Farbe des Tipps zurück (fürs Frontend)
* Gibt die CSS-Klasse für die Farbe des Tipps zurück (portiert aus Legacy Tipp::trendCol).
*
* - "col_tendenz" = richtige Tendenz (grau)
* - "col_exact" = richtiges Ergebnis (orange)
* - "col_joker_exact" = richtiges Ergebnis mit Joker (rot)
* - "" = kein Treffer, nicht getippt oder noch kein Ergebnis
*/
public static function getCol($goals1, $goals2, $tipp1, $tipp2, $joker) {
if ($tipp1 == -1 || $tipp2 == -1 || $goals1 == -1 || $goals2 == -1) {
return "";
}
// 1. Exaktes Ergebnis
if ($tipp1 == $goals1 && $tipp2 == $goals2) {
return "col_exact";
if (self::isExact($goals1, $goals2, $tipp1, $tipp2)) {
return $joker ? "col_joker_exact" : "col_exact";
}
// Tendenzen berechnen
$tippTendenz = $tipp1 - $tipp2;
$gameTendenz = $goals1 - $goals2;
$tippSign = $tipp1 <=> $tipp2;
$gameSign = $goals1 <=> $goals2;
// 2. Richtige Tordifferenz (impliziert richtige Tendenz, außer bei Unentschieden)
if ($tippTendenz == $gameTendenz) {
return "col_diff";
}
// 3. Richtige Tendenz (Sieg, Niederlage, Unentschieden)
// Normalisiere Tendenz auf -1, 0, 1
$tippSign = ($tippTendenz > 0) ? 1 : (($tippTendenz < 0) ? -1 : 0);
$gameSign = ($gameTendenz > 0) ? 1 : (($gameTendenz < 0) ? -1 : 0);
if ($tippSign == $gameSign) {
return "col_tendenz";
}
// Kein Treffer
return "";
return $tippSign === $gameSign ? "col_tendenz" : "";
}
/**