Skip to content

Commit

Permalink
Fix adding/removing platform #57
Browse files Browse the repository at this point in the history
  • Loading branch information
Clidus committed Apr 16, 2016
1 parent 10f9560 commit 76230e3
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions ignition_application/controllers/games.php
Expand Up @@ -225,11 +225,9 @@ function addPlatform()
return;
}

// load game model
$this->load->model('Game');

// check if game is in collection
$collection = $this->Game->isGameIsInCollection($GBID, $userID);
$this->load->model('Collection');
$collection = $this->Collection->isGameIsInCollection($GBID, $userID);

// if game is not in collection
if($collection == null)
Expand All @@ -239,7 +237,7 @@ function addPlatform()
}

// if game is not on platform, add it
if(!$this->Game->isGameOnPlatformInCollection($collection->ID, $GBPlatformID))
if(!$this->Collection->isGameOnPlatformInCollection($collection->ID, $GBPlatformID))
{
// load platform model
$this->load->model('Platform');
Expand All @@ -262,7 +260,7 @@ function addPlatform()
}

// add game to platform in collection
$this->Game->addPlatform($collection->ID, $GBPlatformID);
$this->Collection->addPlatform($collection->ID, $GBPlatformID);
}

// record event
Expand Down Expand Up @@ -292,11 +290,9 @@ function removePlatform()
return;
}

// load game model
$this->load->model('Game');

// check if game is in collection
$collection = $this->Game->isGameIsInCollection($GBID, $userID);
$this->load->model('Collection');
$collection = $this->Collection->isGameIsInCollection($GBID, $userID);

// if game is not in collection
if($collection == null)
Expand All @@ -306,7 +302,7 @@ function removePlatform()
}

// remove platform from game in collection
$this->Game->removePlatform($collection->ID, $GBPlatformID);
$this->Collection->removePlatform($collection->ID, $GBPlatformID);

$result['error'] = false;
echo json_encode($result);
Expand Down

0 comments on commit 76230e3

Please sign in to comment.