close #50 changed table names back to "default" camelCase names, fixed map query bug

This commit is contained in:
Exodus4D
2015-11-10 22:41:21 +01:00
parent 9989e51f6f
commit 4837b46e87
5 changed files with 36 additions and 18 deletions

View File

@@ -175,6 +175,10 @@ class Map extends \Controller\AccessController {
isset($mapData['data']['systems']) &&
isset($mapData['data']['connections'])
){
if(isset($mapData['id'])){
unset($mapData['id']);
}
$map->setData($mapData['config']);
$map->typeId = (int)$importData['typeId'];
$map->save();
@@ -184,6 +188,9 @@ class Map extends \Controller\AccessController {
$tempSystemIdMapping = [];
foreach($mapData['data']['systems'] as $systemData){
if(isset($systemData['id'])){
unset($systemData['id']);
}
$system->setData($systemData);
$system->mapId = $map;
$system->createdCharacterId = $activeCharacter->characterId;
@@ -200,6 +207,10 @@ class Map extends \Controller\AccessController {
isset( $tempSystemIdMapping[$connectionData['source']] ) &&
isset( $tempSystemIdMapping[$connectionData['target']] )
){
if(isset($connectionData['id'])){
unset($connectionData['id']);
}
$connection->setData($connectionData);
$connection->mapId = $map;
$connection->source = $tempSystemIdMapping[$connectionData['source']];
@@ -502,10 +513,10 @@ class Map extends \Controller\AccessController {
foreach($systems as $i => $systemData){
// check if current system belongs to the current map
$map->filter('systems', array('id = ?', $systemData['id'] ));
$map->filter('systems', ['id = ?', $systemData['id'] ]);
$filteredMap = $map->find(
array('id = ?', $map->id ),
array('limit' => 1)
['id = ?', $map->id ],
['limit' => 1]
);
// this should never fail
@@ -531,10 +542,10 @@ class Map extends \Controller\AccessController {
foreach($connections as $i => $connectionData){
// check if the current connection belongs to the current map
$map->filter('connections', array('id = ?', $connectionData['id'] ));
$map->filter('connections', ['id = ?', $connectionData['id'] ]);
$filteredMap = $map->find(
array('id = ?', $map->id ),
array('limit' => 1)
['id = ?', $map->id ],
['limit' => 1]
);
// this should never fail

View File

@@ -217,14 +217,14 @@ class Route extends \Controller\AccessController {
SELECT
GROUP_CONCAT( NULLIF(map_sys_inner.solarSystemName, NULL) SEPARATOR ':')
FROM
mapsolarsystemjumps map_jump INNER JOIN
mapsolarsystems map_sys_inner ON
mapSolarSystemJumps map_jump INNER JOIN
mapSolarSystems map_sys_inner ON
map_sys_inner.solarSystemID = map_jump.toSolarSystemID
WHERE
map_jump.fromSolarSystemID = map_sys.solarSystemID
) system_neighbours
FROM
mapsolarsystems map_sys
mapSolarSystems map_sys
HAVING
-- skip systems without neighbors (e.g. WHs)
system_neighbours IS NOT NULL

View File

@@ -26,8 +26,8 @@ class System extends \Controller\AccessController {
SELECT
LOWER( system_effect.typeName )
FROM
invtypes system_effect INNER JOIN
mapdenormalize map_norm ON
invTypes system_effect INNER JOIN
mapDenormalize map_norm ON
map_norm.typeID = system_effect.typeID
WHERE
system_effect.groupID = 995 AND
@@ -39,16 +39,16 @@ class System extends \Controller\AccessController {
SELECT
map_worm_class.wormholeClassID system_class
FROM
maplocationwormholeclasses map_worm_class
mapLocationWormholeClasses map_worm_class
WHERE
map_worm_class.locationID = map_sys.regionID
LIMIT 1
), 7) security
FROM
mapsolarsystems map_sys INNER JOIN
mapconstellations map_con ON
mapSolarSystems map_sys INNER JOIN
mapConstellations map_con ON
map_con.constellationID = map_sys.constellationID INNER JOIN
mapregions map_reg ON
mapRegions map_reg ON
map_reg.regionID = map_sys.regionID";
private $whereQuery = "";

View File

@@ -202,7 +202,11 @@ class MapModel extends BasicModel {
*/
public function getSystems(){
// orderBy x-Coordinate for cleaner frontend animation (left to right)
$this->filter('systems', ['active = ?', 1], ['order' => 'posX']);
$this->filter('systems',
['active = :active AND id > 0',
':active' => 1
],
['order' => 'posX']);
$systems = [];
if($this->systems){
@@ -233,7 +237,10 @@ class MapModel extends BasicModel {
* @return array|mixed
*/
public function getConnections(){
$this->filter('connections', ['active = ?', 1]);
$this->filter('connections', [
'active = :active AND source > 0 AND target > 0',
':active' => 1
]);
$connections = [];
if($this->connections){

View File

@@ -39,7 +39,7 @@ DB_PASS =
; EVE-Online CCP Database export
DB_CCP_DNS = mysql:host=localhost;port=3306;dbname=
DB_CCP_NAME = eve_test
DB_CCP_NAME = eve_parallax
DB_CCP_USER = root
DB_CCP_PASS =