fix character cache updates when changing XP-levels

This commit is contained in:
oliver 2015-10-23 13:17:00 +02:00
commit 5b68bab5d5
7 changed files with 249 additions and 57 deletions

View file

@ -159,6 +159,9 @@
// No XP-level
}
$character['rank'] = $this->Characters->getXPRank($seminary['id'], $character['xps']);
if(!is_null($character['avatar_id'])) {
$character['avatar'] = $this->Avatars->getAvatarById($character['avatar_id']);
}
// Get User
$user = $this->Users->getUserById($character['user_id']);
@ -371,7 +374,6 @@
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
// Set sort order and page
$selectedCharacters = array();
$sortorder = 'name';
if($this->request->getRequestMethod() == 'POST')
@ -443,7 +445,15 @@
$characters = $this->Characters->getCharactersForSeminarySorted($seminary['id'], $sortorder);
foreach($characters as &$character)
{
$character['xplevel'] = $this->Xplevels->getXPLevelById($character['xplevel_id']);
try {
$character['xplevel'] = $this->Xplevels->getXPLevelById($character['xplevel_id']);
}
catch(\nre\exceptions\IdNotFoundException $e) {
// No XP-level
}
if(!is_null($character['avatar_id'])) {
$character['avatar'] = $this->Avatars->getAvatarById($character['avatar_id']);
}
$character['user'] = $this->Users->getUserById($character['user_id']);
$character['characterroles'] = array_map(function($r) { return $r['name']; }, $this->Characterroles->getCharacterrolesForCharacterById($character['id']));
$character['characterfields'] = array();