Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
3 changed files with 27 additions and 3 deletions
Showing only changes of commit 92243189ee - Show all commits

View File

@ -422,8 +422,14 @@ final class Model {
$item['included'] = $included;
}
$transformed = $this->animeListTransformer->transformCollection($data['data']);
$keyed = [];
$cacheItem->set($transformed);
foreach($transformed as $item)
{
$keyed[$item['id']] = $item;
}
$cacheItem->set($keyed);
$cacheItem->save();
}

View File

@ -66,7 +66,7 @@ final class Manga extends Controller {
*/
public function index($status = 'all', $view = ''): void
{
if ( ! in_array($type, [
if ( ! in_array($status, [
'all',
'reading',
'plan_to_read',

View File

@ -29,6 +29,11 @@ class API {
*/
protected function sortByName(array &$array, string $sortKey): void
{
if (empty($array))
{
return;
}
$sort = [];
foreach ($array as $key => $item)
@ -37,5 +42,18 @@ class API {
}
array_multisort($sort, SORT_ASC, $array);
// Re-key array items by their ids
if (array_key_exists('id', $array[0]))
{
$keyed = [];
foreach($array as $item)
{
$keyed[$item['id']] = $item;
}
$array = $keyed;
}
}
}