BUG: Minor revert

This commit is contained in:
Ivymaster
2026-10-14 10:05:12 +02:00
parent d70a5cc731
commit 8b4a67ed60
+16 -1
View File
@@ -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);
}