Skip to content

Commit

Permalink
fixup! fix(caldav): event search with limit and timerange
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed May 8, 2024
1 parent 9986aaf commit ab8f6cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1991,12 +1991,12 @@ public function search(
$outerQuery->setMaxResults($maxResults);

for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) {
$objectsCount = array_push($calendarObjects, ...$this->searchCalendarObjectsByQuery($outerQuery, $start, $end));
$objectsCount = array_push($calendarObjects, ...$this->searchCalendarObjects($outerQuery, $start, $end));
$outerQuery->setFirstResult($offset += $maxResults);
}
} else {
$outerQuery->setMaxResults($limit);
$calendarObjects = $this->searchCalendarObjectsByQuery($outerQuery, $start, $end);
$calendarObjects = $this->searchCalendarObjects($outerQuery, $start, $end);
}

return array_map(function ($o) use ($options) {
Expand Down Expand Up @@ -2037,7 +2037,7 @@ public function search(
}, $calendarObjects);
}

private function searchCalendarObjectsByQuery(IQueryBuilder $query, DateTimeInterface|null $start, DateTimeInterface|null $end): array {
private function searchCalendarObjects(IQueryBuilder $query, DateTimeInterface|null $start, DateTimeInterface|null $end): array {
$calendarObjects = [];
$filterByTimeRange = ($start instanceof DateTimeInterface) || ($end instanceof DateTimeInterface);

Expand Down

0 comments on commit ab8f6cf

Please sign in to comment.