mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-26 22:03:01 +00:00
BUG: Minor revert
This commit is contained in:
@@ -1601,7 +1601,7 @@ class KalenderLib
|
||||
return $this->_ci->KalenderModel->execReadOnlyQuery($query);
|
||||
}
|
||||
|
||||
private function _mapEvents($data, $collisionCheck = true)
|
||||
private function _mapEvents($data, $collisionCheck = true, $maxDailyEventLimit = null)
|
||||
{
|
||||
$stundenplan_data = [];
|
||||
|
||||
@@ -1769,6 +1769,21 @@ class KalenderLib
|
||||
usort($event->ort_kurzbz, 'strnatcasecmp');
|
||||
}
|
||||
|
||||
if (!is_null($maxDailyEventLimit) && is_numeric($maxDailyEventLimit) && $maxDailyEventLimit > 0)
|
||||
{
|
||||
$eventsPerDay = [];
|
||||
$events = array_filter($events, function ($event) use (&$eventsPerDay, $maxDailyEventLimit) {
|
||||
$date = $event->datum;
|
||||
$eventsPerDay[$date] = $eventsPerDay[$date] ?? 0;
|
||||
|
||||
if ($eventsPerDay[$date] >= $maxDailyEventLimit)
|
||||
return false;
|
||||
|
||||
$eventsPerDay[$date]++;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
return array_values($events);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user