Erweiterte Spielerstatistiken: 7-Meter, Strafen, Spielzeit
Neue Metriken für Jugendhandball: 7m-Würfe/-Tore, Gelbe Karten, 2-Minuten-Strafen und Spielzeit. Migration, Model, Controller, Views und Übersetzungen (6 Sprachen) vollständig implementiert. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ use App\Models\EventTimekeeper;
|
||||
use App\Models\File;
|
||||
use App\Models\FileCategory;
|
||||
use App\Models\Location;
|
||||
use App\Models\Season;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Team;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -55,11 +56,20 @@ class EventController extends Controller
|
||||
$query->where('status', $request->status);
|
||||
}
|
||||
|
||||
// Saison-Filter
|
||||
if ($request->filled('season_id')) {
|
||||
$season = Season::find($request->season_id);
|
||||
if ($season) {
|
||||
$query->whereBetween('start_at', [$season->start_date, $season->end_date->endOfDay()]);
|
||||
}
|
||||
}
|
||||
|
||||
$events = $query->paginate(20)->withQueryString();
|
||||
$teams = Team::active()->orderBy('name')->get();
|
||||
$seasons = Season::orderByDesc('start_date')->get();
|
||||
$trashedEvents = Event::onlyTrashed()->with('team')->latest('deleted_at')->get();
|
||||
|
||||
return view('admin.events.index', compact('events', 'teams', 'trashedEvents'));
|
||||
return view('admin.events.index', compact('events', 'teams', 'seasons', 'trashedEvents'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
@@ -229,6 +239,11 @@ class EventController extends Controller
|
||||
'stats.*.goalkeeper_shots' => ['nullable', 'integer', 'min:0', 'max:999'],
|
||||
'stats.*.goals' => ['nullable', 'integer', 'min:0', 'max:999'],
|
||||
'stats.*.shots' => ['nullable', 'integer', 'min:0', 'max:999'],
|
||||
'stats.*.penalty_goals' => ['nullable', 'integer', 'min:0', 'max:99'],
|
||||
'stats.*.penalty_shots' => ['nullable', 'integer', 'min:0', 'max:99'],
|
||||
'stats.*.yellow_cards' => ['nullable', 'integer', 'min:0', 'max:3'],
|
||||
'stats.*.two_minute_suspensions' => ['nullable', 'integer', 'min:0', 'max:3'],
|
||||
'stats.*.playing_time_minutes' => ['nullable', 'integer', 'min:0', 'max:90'],
|
||||
'stats.*.note' => ['nullable', 'string', 'max:500'],
|
||||
]);
|
||||
|
||||
@@ -242,9 +257,17 @@ class EventController extends Controller
|
||||
$gkSaves = $isGk && isset($data['goalkeeper_saves']) && $data['goalkeeper_saves'] !== '' ? (int) $data['goalkeeper_saves'] : null;
|
||||
$gkShots = $isGk && isset($data['goalkeeper_shots']) && $data['goalkeeper_shots'] !== '' ? (int) $data['goalkeeper_shots'] : null;
|
||||
$note = ! empty($data['note']) ? trim($data['note']) : null;
|
||||
$penaltyGoals = isset($data['penalty_goals']) && $data['penalty_goals'] !== '' ? (int) $data['penalty_goals'] : null;
|
||||
$penaltyShots = isset($data['penalty_shots']) && $data['penalty_shots'] !== '' ? (int) $data['penalty_shots'] : null;
|
||||
$yellowCards = isset($data['yellow_cards']) && $data['yellow_cards'] !== '' ? (int) $data['yellow_cards'] : null;
|
||||
$twoMinSuspensions = isset($data['two_minute_suspensions']) && $data['two_minute_suspensions'] !== '' ? (int) $data['two_minute_suspensions'] : null;
|
||||
$playingTime = isset($data['playing_time_minutes']) && $data['playing_time_minutes'] !== '' ? (int) $data['playing_time_minutes'] : null;
|
||||
|
||||
// Leere Einträge löschen
|
||||
if (! $isGk && $goals === null && $shots === null && $note === null && $position === null) {
|
||||
$hasData = $isGk || $goals !== null || $shots !== null || $note !== null || $position !== null
|
||||
|| $penaltyGoals !== null || $penaltyShots !== null || $yellowCards !== null
|
||||
|| $twoMinSuspensions !== null || $playingTime !== null;
|
||||
if (! $hasData) {
|
||||
EventPlayerStat::where('event_id', $event->id)->where('player_id', $playerId)->delete();
|
||||
continue;
|
||||
}
|
||||
@@ -258,6 +281,11 @@ class EventController extends Controller
|
||||
'goalkeeper_shots' => $gkShots,
|
||||
'goals' => $goals,
|
||||
'shots' => $shots,
|
||||
'penalty_goals' => $penaltyGoals,
|
||||
'penalty_shots' => $penaltyShots,
|
||||
'yellow_cards' => $yellowCards,
|
||||
'two_minute_suspensions' => $twoMinSuspensions,
|
||||
'playing_time_minutes' => $playingTime,
|
||||
'note' => $note,
|
||||
]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user