diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index ae5c964d..8dc8ac68 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -672,11 +672,13 @@ class ApiController extends Controller $preloadDayIds = []; $preloadDays = []; foreach ($days as &$day) { + if ($day['count'] <= 0) continue; + $preloaded += $day['count']; $preloadDayIds[] = $day['dayid']; $preloadDays[] = &$day; - if ($preloaded >= 50) { // should be enough + if ($preloaded >= 50 || count($preloadDayIds) > 5) { // should be enough break; } }