Tippen: nach dem Speichern zur eigenen Runde zurückkehren
Bisher leitete die Tippabgabe immer zur ersten tippbaren Runde. Wer eine spätere Runde tippte, landete dadurch am Anfang der Tippseite. Jetzt führt die Weiterleitung mit ?tipped=<id>#round-<id> zur gerade getippten Runde. Der automatische Sprung zur ersten offenen Runde greift dort nicht mehr, falls die Runde beim Speichern gerade gesperrt ist. Zusätzlich ist gen_codemap.py wieder mit dem System-Python 3.9 lauffähig (Typannotation ohne |-Operator), damit der Commit-Hook durchläuft.
This commit is contained in:
parent
6a16f90b2f
commit
1cf9b9cfc7
4 changed files with 48 additions and 33 deletions
|
|
@ -10,13 +10,13 @@ Diese Datei ersetzt die Erkundung. Erst hier nachschlagen, dann gezielt mit
|
|||
Abschnitt zu lesen. `docs/legacy/` ist absichtlich ausgeblendet (siehe
|
||||
`.ignore`); dort liegt der alte Laravel-Stand.
|
||||
|
||||
Umfang: 11427 Zeilen in 66 Dateien.
|
||||
Umfang: 11436 Zeilen in 66 Dateien.
|
||||
|
||||
## Einstiegspunkte
|
||||
|
||||
| Datei | Zeilen | Zweck |
|
||||
|---|---|---|
|
||||
| `tippspiel/public/index.php` | 1200 | Front-Controller; Routing ist eine if/elseif-Kette auf `?page=` |
|
||||
| `tippspiel/public/index.php` | 1206 | Front-Controller; Routing ist eine if/elseif-Kette auf `?page=` |
|
||||
| `tippspiel/src/autoload.php` | 26 | PSR-4-artiger Autoloader für `App\` |
|
||||
| `tools/schema.sql` | 204 | Schema der neuen DB (Tabellen, Indizes) |
|
||||
| `tippspiel/public/sw.js` | 114 | Service Worker für Web-Push |
|
||||
|
|
@ -31,29 +31,29 @@ Umfang: 11427 Zeilen in 66 Dateien.
|
|||
| `register` | — | `register`, `login` | 107 |
|
||||
| `logout` | — | — | 181 |
|
||||
| `tipp_game` | Login | `tipps/game` (Fallback) | 185 |
|
||||
| `tipps` | Login | `tipps/index` | 205 |
|
||||
| `tipp_round` | Login | `tipps/round` | 226 |
|
||||
| `datenschutz` | — | `info/privacy` | 297 |
|
||||
| `guide` | Login | `info/guide` | 300 |
|
||||
| `guide_admin` | Admin | `info/guide_admin` | 311 |
|
||||
| `info_quotas` | Login | `info/quotas` | 316 |
|
||||
| `money_ranking` | Login | `tipps/no_payment`, `info/no_ranking`, `info/money_ranking_detail`, `info/money_ranking` | 328 |
|
||||
| `admin_accounts` | Admin | `admin/accounts` | 360 |
|
||||
| `admin_message` | Admin | `admin/message` | 373 |
|
||||
| `admin_fetcher_activity` | Admin | `admin/fetcher_activity` | 391 |
|
||||
| `push_subscribe` | Login | (JSON) | 406 |
|
||||
| `push_unsubscribe` | Login | — | 433 |
|
||||
| `push_test` | Login | — | 439 |
|
||||
| `settings` | Login | `settings` | 508 |
|
||||
| `admin` | Admin | — | 556 |
|
||||
| `admin_seasons` | Admin | `admin/seasons` | 580 |
|
||||
| `admin_rounds` | Admin | `admin/rounds` | 690 |
|
||||
| `admin_roundmails` | Admin | `admin/roundmails` | 798 |
|
||||
| `admin_users` | Admin | `admin/users` | 865 |
|
||||
| `round` | Login | `round` | 969 |
|
||||
| `ranking` | Login | `ranking` | 1028 |
|
||||
| `questions` | Login | `questions` | 1093 |
|
||||
| `home` | Login | `home` | 1156 |
|
||||
| `tipps` | Login | `tipps/index` | 209 |
|
||||
| `tipp_round` | Login | `tipps/round` | 232 |
|
||||
| `datenschutz` | — | `info/privacy` | 303 |
|
||||
| `guide` | Login | `info/guide` | 306 |
|
||||
| `guide_admin` | Admin | `info/guide_admin` | 317 |
|
||||
| `info_quotas` | Login | `info/quotas` | 322 |
|
||||
| `money_ranking` | Login | `tipps/no_payment`, `info/no_ranking`, `info/money_ranking_detail`, `info/money_ranking` | 334 |
|
||||
| `admin_accounts` | Admin | `admin/accounts` | 366 |
|
||||
| `admin_message` | Admin | `admin/message` | 379 |
|
||||
| `admin_fetcher_activity` | Admin | `admin/fetcher_activity` | 397 |
|
||||
| `push_subscribe` | Login | (JSON) | 412 |
|
||||
| `push_unsubscribe` | Login | — | 439 |
|
||||
| `push_test` | Login | — | 445 |
|
||||
| `settings` | Login | `settings` | 514 |
|
||||
| `admin` | Admin | — | 562 |
|
||||
| `admin_seasons` | Admin | `admin/seasons` | 586 |
|
||||
| `admin_rounds` | Admin | `admin/rounds` | 696 |
|
||||
| `admin_roundmails` | Admin | `admin/roundmails` | 804 |
|
||||
| `admin_users` | Admin | `admin/users` | 871 |
|
||||
| `round` | Login | `round` | 975 |
|
||||
| `ranking` | Login | `ranking` | 1034 |
|
||||
| `questions` | Login | `questions` | 1099 |
|
||||
| `home` | Login | `home` | 1162 |
|
||||
|
||||
Alle übrigen Pfade laufen auf `home` bzw. 404. Reihenfolge und Bedingungen
|
||||
stehen in `tippspiel/public/index.php`. `(Fallback)` markiert Seiten eines
|
||||
|
|
@ -122,7 +122,7 @@ ohne View.
|
|||
| `tippspiel/src/Views/round.php` | 101 | Tippübersicht aller Spieler bis zu einer Runde |
|
||||
| `tippspiel/src/Views/settings.php` | 293 | Eigene Daten: IBAN/PayPal/Mobilnummer, E-Mail, Erinnerungen |
|
||||
| `tippspiel/src/Views/tipps/game.php` | 82 | Tipp-Formular für ein einzelnes Spiel |
|
||||
| `tippspiel/src/Views/tipps/index.php` | 212 | Tipp-Startseite: Runden mit Spielen, eigenen Tipps und Joker |
|
||||
| `tippspiel/src/Views/tipps/index.php` | 221 | Tipp-Startseite: Runden mit Spielen, eigenen Tipps und Joker |
|
||||
| `tippspiel/src/Views/tipps/no_payment.php` | 9 | Hinweis auf offene Zahlung vor der Tippabgabe |
|
||||
| `tippspiel/src/Views/tipps/round.php` | 107 | Rundenliste mit Spielen, Tipps und Joker |
|
||||
|
||||
|
|
|
|||
|
|
@ -196,8 +196,12 @@ if ($page === 'reminder') {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Nach dem Speichern zur ersten tippbaren Runde springen (wie im Legacy)
|
||||
$tippsUrl = function () use ($activeSeason) {
|
||||
// Nach dem Speichern zur gerade getippten Runde springen. Ohne Rundenbezug
|
||||
// (z. B. ungültige ID) gilt wie im Legacy die erste tippbare Runde.
|
||||
$tippsUrl = function ($roundId = null) use ($activeSeason) {
|
||||
if ($roundId) {
|
||||
return '/index.php?page=tipps&tipped=' . (int)$roundId . '#round-' . (int)$roundId;
|
||||
}
|
||||
$round = Round::getFirstTippable($activeSeason['id']);
|
||||
return '/index.php?page=tipps' . ($round ? '#round-' . $round['id'] : '');
|
||||
};
|
||||
|
|
@ -205,6 +209,8 @@ if ($page === 'reminder') {
|
|||
if ($page === 'tipps') {
|
||||
$rounds = [];
|
||||
$firstTippableRoundId = null;
|
||||
// Runde, aus der der Spieler gerade kam (nach dem Speichern gesetzt).
|
||||
$tippedRoundId = isset($_GET['tipped']) ? (int)$_GET['tipped'] : 0;
|
||||
foreach (Round::getBySeason($activeSeason['id']) as $round) {
|
||||
$round['games'] = Game::getGamesByRound($round['id']);
|
||||
$round['tipps'] = Tipp::findByUserAndRound($user['id'], $round['id']);
|
||||
|
|
@ -240,7 +246,7 @@ if ($page === 'reminder') {
|
|||
$jokerGameId = isset($_POST['joker']) && $_POST['joker'] !== '' ? (int)$_POST['joker'] : null;
|
||||
$error = Tipp::saveRound($user['id'], $round['id'], $_POST['scores'] ?? [], $jokerGameId);
|
||||
if ($error === null) {
|
||||
header('Location: ' . $tippsUrl());
|
||||
header('Location: ' . $tippsUrl($round['id']));
|
||||
exit;
|
||||
}
|
||||
$formScores = $_POST['scores'] ?? [];
|
||||
|
|
@ -280,7 +286,7 @@ if ($page === 'reminder') {
|
|||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$error = Tipp::saveSingle($user['id'], $game['id'], $_POST['score1'] ?? '', $_POST['score2'] ?? '', isset($_POST['joker']));
|
||||
if ($error === null) {
|
||||
header('Location: ' . $tippsUrl());
|
||||
header('Location: ' . $tippsUrl($round['id']));
|
||||
exit;
|
||||
}
|
||||
$formTipp = ['score1' => $_POST['score1'] ?? '', 'score2' => $_POST['score2'] ?? '', 'joker' => isset($_POST['joker'])];
|
||||
|
|
|
|||
|
|
@ -105,8 +105,10 @@ $quickRounds = array_slice($openRounds, 0, 6);
|
|||
// veralteter Anker (z. B. #round-981 aus einer früheren Speicherung) erkannt:
|
||||
// Liegt die verlinkte Runde inzwischen hinter der Sperre, springt die Seite
|
||||
// automatisch zur nächsten offenen Runde und korrigiert die Adresse.
|
||||
// Ausnahme: Die Runde, aus der der Spieler gerade getippt hat, bleibt stehen.
|
||||
(function () {
|
||||
const firstTippableId = <?php echo (int)$firstTippableRoundId; ?>;
|
||||
const tippedRoundId = <?php echo (int)($tippedRoundId ?? 0); ?>;
|
||||
const serverNowMs = <?php echo time() * 1000; ?>;
|
||||
const clientNowAtLoad = Date.now();
|
||||
const sections = Array.from(document.querySelectorAll('.tipp-round'));
|
||||
|
|
@ -135,8 +137,15 @@ $quickRounds = array_slice($openRounds, 0, 6);
|
|||
|
||||
function jumpToOpenRound() {
|
||||
const target = roundFromHash();
|
||||
if (target && isOpen(target)) {
|
||||
return; // bewusst verlinkte, noch offene Runde nicht überschreiben
|
||||
if (target) {
|
||||
// Gerade getippte Runde nicht überschreiben, auch wenn sie inzwischen sperrt.
|
||||
if (tippedRoundId && target.id === 'round-' + tippedRoundId) {
|
||||
target.scrollIntoView();
|
||||
return;
|
||||
}
|
||||
if (isOpen(target)) {
|
||||
return; // bewusst verlinkte, noch offene Runde nicht überschreiben
|
||||
}
|
||||
}
|
||||
|
||||
const fallback = firstOpenRound() || document.getElementById('round-' + firstTippableId);
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ def main() -> int:
|
|||
tools_php = sorted((ROOT / "tools").glob("*.php"))
|
||||
tools_py = sorted((ROOT / "tools").glob("*.py"))
|
||||
|
||||
def row(path: Path, desc: str, methods: list[str] | None) -> list[str]:
|
||||
def row(path: Path, desc: str, methods) -> list[str]:
|
||||
m = ""
|
||||
if methods:
|
||||
m = ", ".join(f"`{x}`" for x in methods[:8])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue