Skip to content

Commit

Permalink
Fix error when no matchgrid (CO-2297) and other errata
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Dec 10, 2021
1 parent 7412d59 commit 16a28a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,17 @@ public function index() {
$query = $table->find();
}
catch(\Cake\Database\Exception $e) {
if($modelsName == 'MatchgridRecords' && $e->getCode() == 500) {
if($modelsName == 'MatchgridRecords') {
$this->Flash->error(__('match.er.mg.notfound', [$e->getMessage()]));

return $this->redirect([
'controller' => 'matchgrids',
'action' => 'manage',
$this->cur_mg->id
]);
} else {
// Rethrow the exception
throw new \RuntimeException($e->getMessage());
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/Controller/TierApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ protected function doMatchRequest(bool $searchOnly=false) {
throw new \InvalidArgumentException('No JSON record found or body not successfully parsed');
}

// getParsedBody can apparently return either an array or an object
// according to its mood. We originally assumed an object, so if we get
// an array we'll convert it to an object.
if(is_array($json)) {
$json = (object)$json;
}

$AttributeManager = new \App\Lib\Match\AttributeManager();
$MatchService = new \App\Lib\Match\MatchService();

Expand Down
1 change: 1 addition & 0 deletions app/src/View/Helper/BadgeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function badgeIt(
string $fa_class = null,
bool $dis_text_dark = false
) {
$fa_element = '';

$badge_classes = [];

Expand Down

0 comments on commit 16a28a4

Please sign in to comment.