diff --git a/lib/Controller/LocationsController.php b/lib/Controller/LocationsController.php index c9fe847a..05284e6d 100644 --- a/lib/Controller/LocationsController.php +++ b/lib/Controller/LocationsController.php @@ -77,7 +77,7 @@ class LocationsController extends ApiBase $list = $this->timelineQuery->daysToMonths($list); } else { // Preload some day responses - $this->preloadDays($list, $uid, $root); + $this->preloadDaysWithBounds($list, $uid, $root, $minLat, $maxLat, $minLng, $maxLng); } // Reverse response if requested. Folders still stay at top. @@ -98,10 +98,6 @@ class LocationsController extends ApiBase public function dayWithBounds(string $id, string $minLat, string $maxLat, string $minLng, string $maxLng): JSONResponse { - // $minLat = (float) $minLat; - // $maxLat = (float) $maxLat; - // $minLng = (float) $minLng; - // $maxLng = (float) $maxLng; if (null === $minLat || null === $maxLat || null === $minLng || null === $maxLng) { return new JSONResponse([], Http::STATUS_BAD_REQUEST); } @@ -252,8 +248,12 @@ class LocationsController extends ApiBase * @param array $days the days array * @param string $uid User ID or blank for public shares * @param TimelineRoot $root the root folder + * @param string $minLat + * @param string $maxLat + * @param string $minLng + * @param string $maxLng */ - private function preloadDays(array &$days, string $uid, TimelineRoot &$root) + private function preloadDaysWithBounds(array &$days, string $uid, TimelineRoot &$root, string $minLat, string $maxLat, string $minLng, string $maxLng) { $transforms = $this->getTransformations(false); $preloaded = 0; @@ -274,13 +274,17 @@ class LocationsController extends ApiBase } if (\count($preloadDayIds) > 0) { - $allDetails = $this->timelineQuery->getDay( + $allDetails = $this->timelineQuery->getDayWithBounds( $root, $uid, $preloadDayIds, $this->isRecursive(), $this->isArchive(), $transforms, + $minLat, + $maxLat, + $minLng, + $maxLng ); // Group into dayid diff --git a/lib/Db/TimelineQueryDays.php b/lib/Db/TimelineQueryDays.php index f576c57e..8cd051b9 100644 --- a/lib/Db/TimelineQueryDays.php +++ b/lib/Db/TimelineQueryDays.php @@ -132,10 +132,10 @@ trait TimelineQueryDays * @param bool $recursive Whether to get the days recursively * @param bool $archive Whether to get the days only from the archive folder * @param array $queryTransforms An array of query transforms to apply to the query - * @param float $minLat The minimum latitude - * @param float $maxLat The maximum latitude - * @param float $minLng The minimum longitude - * @param float $maxLng The maximum longitude + * @param string $minLat The minimum latitude + * @param string $maxLat The maximum latitude + * @param string $minLng The minimum longitude + * @param string $maxLng The maximum longitude * * @return array The days response */ @@ -265,10 +265,10 @@ trait TimelineQueryDays * @param bool $archive If the query should include only the archive folder * @param array $queryTransforms The query transformations to apply * @param mixed $day_ids - * @param mixed $minLat The minimum latitude - * @param mixed $maxLat The maximum latitude - * @param mixed $minLng The minimum longitude - * @param mixed $maxLng The maximum longitude + * @param string $minLat The minimum latitude + * @param string $maxLat The maximum latitude + * @param string $minLng The minimum longitude + * @param string $maxLng The maximum longitude * * @return array An array of day responses */