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:
parent
7ecd38cb20
commit
36c356b69c
2 changed files with 17 additions and 33 deletions
|
|
@ -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" : "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,11 +66,10 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
|
||||
<div class="legend">
|
||||
<div class="legend-item"><span class="daily-winner-icon">🏆</span> Tagessieger</div>
|
||||
<div class="legend-item"><img src="/image.php?file=icons/joker.png" alt="Joker" class="joker-icon"> Joker gesetzt</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: orange;"></div> Exaktes Ergebnis</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: red;"></div> Exakt mit Joker</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: gold;"></div> Richtige Differenz</div>
|
||||
<div class="legend-item"><img src="/icons/joker.png" alt="Joker" class="joker-icon"> Joker gesetzt</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: grey;"></div> Richtige Tendenz</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: orange;"></div> Richtiges Ergebnis</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: red;"></div> Richtiges Ergebnis mit Joker</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
|
|
@ -87,7 +86,7 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
<th class="game-header" colspan="2">
|
||||
<?php echo htmlspecialchars($game['team1']); ?><br>
|
||||
<?php echo htmlspecialchars($game['team2']); ?><br>
|
||||
<small>(<?php echo App\Models\Game::getResultString($game['score1'], $game['score2'], $game['kickoff']); ?>)</small>
|
||||
<small>(<?php echo htmlspecialchars(App\Models\Game::getResultString($game['score1'], $game['score2'], $game['kickoff'])); ?>)</small>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
|
|
@ -103,19 +102,16 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
<?php foreach ($games as $game): ?>
|
||||
<?php
|
||||
$tipp = $entry['tipps'][$game['id']];
|
||||
// Farbklasse kommt fertig aus Tipp::getCol (col_tendenz / col_exact / col_joker_exact)
|
||||
$td_class = $tipp['color'];
|
||||
$title = "Tipp: " . htmlspecialchars($tipp['text']) . " | Punkte: " . $tipp['points'];
|
||||
// Spezielle Farbe für exakten Tipp mit Joker
|
||||
if ($td_class === 'col_exact' && $tipp['is_joker']) {
|
||||
$td_class = 'col_joker_exact';
|
||||
}
|
||||
?>
|
||||
<td class="tipp-cell tipp-points <?php echo htmlspecialchars($td_class); ?>" title="<?php echo $title; ?>">
|
||||
<?php echo $tipp['points']; ?>
|
||||
</td>
|
||||
<td class="tipp-cell tipp-joker" title="<?php echo $title; ?>">
|
||||
<?php if ($tipp['is_joker']): ?>
|
||||
<img src="/image.php?file=icons/joker.png" alt="Joker" class="joker-icon" title="Joker">
|
||||
<img src="/icons/joker.png" alt="Joker" class="joker-icon" title="Joker">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue