Compare commits

...

2 Commits

Author SHA1 Message Date
c02e35580f
use sql field names with tables where join happens
All checks were successful
mapguesser/pipeline/pr-develop This commit looks good
2023-05-02 18:10:22 +02:00
afd58bb91b
update soko-web to 0.10.1 2023-05-02 18:08:53 +02:00
7 changed files with 26 additions and 26 deletions

View File

@ -10,7 +10,7 @@
}
],
"require": {
"esoko/soko-web": "0.10",
"esoko/soko-web": "0.10.1",
"fzaninotto/faker": "^1.9"
},
"require-dev": {

8
composer.lock generated
View File

@ -4,15 +4,15 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "db04b12ad70bbdfe83841fa292277ec6",
"content-hash": "27b6af78f89ef8dde87e918118511571",
"packages": [
{
"name": "esoko/soko-web",
"version": "0.10",
"version": "v0.10.1",
"source": {
"type": "git",
"url": "https://git.esoko.eu/esoko/soko-web.git",
"reference": "fd286c9cffadc4a26609bfa00944f8014a2f3f59"
"reference": "585d469b695365e6f8c0f9b596dbb18b6d3ce584"
},
"require": {
"phpmailer/phpmailer": "^6.8",
@ -33,7 +33,7 @@
"GNU GPL 3.0"
],
"description": "Lightweight web framework",
"time": "2023-05-02T10:55:47+00:00"
"time": "2023-05-02T16:06:33+00:00"
},
{
"name": "fzaninotto/faker",

View File

@ -40,7 +40,7 @@ class ChallengeRepository
$select = new Select(\Container::$dbConnection);
$select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_id']);
$select->innerJoin('users', ['users', 'id'], '=', ['user_in_challenge', 'user_id']);
$select->where('user_id', '=', $user->getId());
$select->where(['user_in_challenge', 'user_id'], '=', $user->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class);
}
@ -50,8 +50,8 @@ class ChallengeRepository
$select = new Select(\Container::$dbConnection);
$select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_id']);
$select->innerJoin('users', ['users', 'id'], '=', ['user_in_challenge', 'user_id']);
$select->where('user_id', '=', $user->getId());
$select->where('is_owner', '=', true);
$select->where(['user_in_challenge', 'user_id'], '=', $user->getId());
$select->where(['user_in_challenge', 'is_owner'], '=', true);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class);
}
@ -60,7 +60,7 @@ class ChallengeRepository
{
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['challenges', 'id'], '=', ['place_in_challenge', 'challenge_id']);
$select->where('place_id', '=', $place->getId());
$select->where(['place_in_challenge', 'place_id'], '=', $place->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class);
}

View File

@ -23,7 +23,7 @@ class GuessRepository
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('user_id', '=', $user->getId());
$select->where('challenge_id', '=', $challenge->getId());
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class);
}
@ -33,8 +33,8 @@ class GuessRepository
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('user_id', '=', $user->getId());
$select->where('challenge_id', '=', $challenge->getId());
$select->where('place_id', '=', $place->getId());
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->where(['place_in_challenge', 'place_id'], '=', $place->getId());
return \Container::$persistentDataManager->selectFromDb($select, Guess::class);
}
@ -44,8 +44,8 @@ class GuessRepository
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('user_id', '=', $userId);
$select->where('challenge_id', '=', $challenge->getId());
$select->orderBy('round');
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy(['place_in_challenge', 'round']);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class);
}
@ -58,8 +58,8 @@ class GuessRepository
}
$select = new Select(\Container::$dbConnection);
$select->where('challenge_id', '=', $challenge->getId());
$select->orderBy('round');
$select->where(['guesses__place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy(['guesses__place_in_challenge', 'round']);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations);
}
@ -72,8 +72,8 @@ class GuessRepository
}
$select = new Select(\Container::$dbConnection);
$select->where('challenge_id', '=', $challenge->getId());
$select->where('round', '=', $round);
$select->where(['guesses__place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->where(['guesses__place_in_challenge', 'round'], '=', $round);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations);
}
@ -82,7 +82,7 @@ class GuessRepository
{
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('place_id', '=', $place->getId());
$select->where(['place_in_challenge', 'place_id'], '=', $place->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class);
}

View File

@ -22,7 +22,7 @@ class MapRepository
$select = new Select(\Container::$dbConnection);
$select->innerJoin('places', ['maps', 'id'], '=', ['places', 'map_id']);
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
$select->where('challenge_id', '=', $challenge->getId());
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->limit(1);
return \Container::$persistentDataManager->selectFromDb($select, Map::class);

View File

@ -110,7 +110,7 @@ class PlaceRepository
$selectUnvisited = new Select(\Container::$dbConnection, 'places');
$selectUnvisited->leftJoin($selectPlacesByCurrentUser, ['places', 'id'], '=', ['places_by_current_user', 'place_id']);
$selectUnvisited->where('map_id', '=', $mapId);
$selectUnvisited->where('last_time', '=', null);
$selectUnvisited->where(['places_by_current_user', 'last_time'], '=', null);
$numberOfUnvisitedPlaces = $selectUnvisited->count();
// look for as many new places as possible but maximum $n
@ -174,8 +174,8 @@ class PlaceRepository
{
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
$select->where('challenge_id', '=', $challenge->getId());
$select->orderBy('round');
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy(['place_in_challenge', 'round']);
$select->limit(1, $round);
return \Container::$persistentDataManager->selectFromDb($select, Place::class);
@ -185,8 +185,8 @@ class PlaceRepository
{
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
$select->where('challenge_id', '=', $challenge->getId());
$select->orderBy('round');
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy(['place_in_challenge', 'round']);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Place::class);
}

View File

@ -57,7 +57,7 @@ class UserInChallengeRepository
$select = new Select(\Container::$dbConnection);
$select->where('user_id', '=', $userId);
$select->where('token', '=', $token);
$select->where(['user_in_challenge__challenge', 'token'], '=', $token);
return \Container::$persistentDataManager->selectFromDb($select, UserInChallenge::class, true, $withRelations);
}