fix: Korrigiere Tipp-Farblogik und bereinige Tooltips
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
parent
d52cb17eab
commit
4478346653
3 changed files with 21 additions and 17 deletions
|
|
@ -51,33 +51,37 @@ class Tipp {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gibt das Styling/die Farbe für die Tendenz zurück (fürs Frontend)
|
||||
* Gibt die CSS-Klasse für die Farbe des Tipps zurück (fürs Frontend)
|
||||
*/
|
||||
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";
|
||||
}
|
||||
|
||||
// Tendenzen berechnen
|
||||
$tippTendenz = $tipp1 - $tipp2;
|
||||
if ($tippTendenz > 0) { $tippTendenz = 1; }
|
||||
if ($tippTendenz < 0) { $tippTendenz = -1; }
|
||||
|
||||
$gameTendenz = $goals1 - $goals2;
|
||||
if ($gameTendenz < 0) { $gameTendenz = -1; }
|
||||
if ($gameTendenz > 0) { $gameTendenz = 1; }
|
||||
|
||||
if ($tippTendenz != $gameTendenz) {
|
||||
return "";
|
||||
// 2. Richtige Tordifferenz (impliziert richtige Tendenz, außer bei Unentschieden)
|
||||
if ($tippTendenz == $gameTendenz) {
|
||||
return "col_diff";
|
||||
}
|
||||
|
||||
$styling = 'background-color:grey;';
|
||||
// 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 (($tipp1 == $goals1) && ($tipp2 == $goals2)) {
|
||||
$styling = 'background-color:orange;';
|
||||
if ($joker) {
|
||||
$styling = 'background-color:red';
|
||||
}
|
||||
if ($tippSign == $gameSign) {
|
||||
return "col_tendenz";
|
||||
}
|
||||
return $styling;
|
||||
|
||||
// Kein Treffer
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue