refactored function and variable names, and replaced variables in inner scope
default-pipeline default-pipeline #173

This commit is contained in:
balazs committed 2021-05-06 17:12:18 +02:00
1 parent 886bd02f88
commit b2535ad78a
3 files changed
+13 -12

No files matched your search

+4 -4
View File
@@ -29,11 +29,11 @@ class PlaceRepository
}
//TODO: use Map and User instead of id
public function getRandomNPlaces(int $mapId, int $n, int $userId = null): array
public function getRandomNPlaces(int $mapId, int $n, ?int $userId): array
{
if(!isset($userId)) {
if(!isset($userId)) { // anonymous single player or multiplayer game
return $this->getRandomNForMapWithValidPano($mapId, $n);
} else {
} else { // authorized user
$unvisitedPlaces = $this->getRandomUnvisitedNForMapWithValidPano($mapId, $n, $userId);
$oldPlaces = $this->getRandomOldNForMapWithValidPano($mapId, $n - count($unvisitedPlaces), $userId);
return array_merge($unvisitedPlaces, $oldPlaces);
@@ -149,7 +149,7 @@ class PlaceRepository
// set order by datetime, oldest first
$selectOldPlaces->orderBy('last_time');
// selection algorithm with preference (weighting) for older places
// selection algorithm with preference (weighting) for older places using Box-Muller transform
$pickGaussianRandomInt = function($numberOfPlaces) {
$stdev = 0.2;
$avg = 0.0;