event : unlisted events are sorted at the end of the program page #10

This commit is contained in:
isUnknown 2024-10-31 16:16:01 +01:00
parent 68bb8a75f9
commit 76994f3936
2 changed files with 18 additions and 7 deletions

View file

@ -14,8 +14,16 @@ return function($kirby) {
}
}
// Trier les événements en fonction de la date la plus proche
$orderedSeason = $orderedSeason->sortBy(function ($event) {
$normalEvents = $orderedSeason->filter(function ($event) {
return $event->status() === 'listed';
});
$endOfProgramEvents = $orderedSeason->filter(function ($event) {
return $event->status() === 'unlisted';
});
$normalEvents = $normalEvents->sortBy(function ($event) {
$sessions = $event->isMapadoEvent() == 'true' ? $event->remoteSessions()->toStructure() : $event->sessions()->toStructure();
$sessionDates = $sessions->map(function($session) {
@ -25,5 +33,7 @@ return function($kirby) {
return min($sessionDates);
});
$orderedSeason = $normalEvents->merge($endOfProgramEvents);
return $orderedSeason;
};