From af09da878201fd64618c78506b060d8716ef7b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Fri, 15 Sep 2023 01:38:26 +0200 Subject: [PATCH] fix unambiguous where and orderBy statements in PlaceRepository --- src/Repository/PlaceRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Repository/PlaceRepository.php b/src/Repository/PlaceRepository.php index e1de617..58b29b5 100644 --- a/src/Repository/PlaceRepository.php +++ b/src/Repository/PlaceRepository.php @@ -109,7 +109,7 @@ class PlaceRepository // count the places never visited $selectUnvisited = new Select(\Container::$dbConnection, 'places'); $selectUnvisited->leftJoin($selectPlacesByCurrentUser, ['places', 'id'], '=', ['places_by_current_user', 'place_id']); - $selectUnvisited->where('map_id', '=', $mapId); + $selectUnvisited->where(['places', 'map_id'], '=', $mapId); $selectUnvisited->where(['places_by_current_user', 'last_time'], '=', null); $numberOfUnvisitedPlaces = $selectUnvisited->count(); @@ -140,11 +140,11 @@ class PlaceRepository // count places that were visited at least once $selectOldPlaces = new Select(\Container::$dbConnection, 'places'); $selectOldPlaces->innerJoin($selectPlacesByCurrentUser, ['places', 'id'], '=', ['places_by_current_user', 'place_id']); - $selectOldPlaces->where('map_id', '=', $mapId); + $selectOldPlaces->where(['places', 'map_id'], '=', $mapId); $numberOfOldPlaces = $selectOldPlaces->count(); // set order by datetime, oldest first - $selectOldPlaces->orderBy('last_time'); + $selectOldPlaces->orderBy(['places_by_current_user', 'last_time']); // selection algorithm with preference (weighting) for older places using Box-Muller transform $pickGaussianRandomInt = function($numberOfPlaces) {