Version 5.1 - All the GraphQL #32
@ -39,13 +39,13 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
|
|
||||||
$genres = array_column($anime['relationships']['genres'], 'name') ?? [];
|
$genres = array_column($anime['relationships']['genres'], 'name') ?? [];
|
||||||
sort($genres);
|
sort($genres);
|
||||||
|
|
||||||
$rating = (int) 2 * $item['attributes']['rating'];
|
$rating = (int) 2 * $item['attributes']['rating'];
|
||||||
|
|
||||||
$total_episodes = array_key_exists('episodeCount', $anime) && (int) $anime['episodeCount'] !== 0
|
$total_episodes = array_key_exists('episodeCount', $anime) && (int) $anime['episodeCount'] !== 0
|
||||||
? (int) $anime['episodeCount']
|
? (int) $anime['episodeCount']
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
$MALid = NULL;
|
$MALid = NULL;
|
||||||
|
|
||||||
if (array_key_exists('mappings', $anime['relationships']))
|
if (array_key_exists('mappings', $anime['relationships']))
|
||||||
@ -59,7 +59,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$streamingLinks = (array_key_exists('streamingLinks', $anime['relationships']))
|
$streamingLinks = (array_key_exists('streamingLinks', $anime['relationships']))
|
||||||
? Kitsu::parseListItemStreamingLinks($included, $animeId)
|
? Kitsu::parseListItemStreamingLinks($included, $animeId)
|
||||||
: [];
|
: [];
|
||||||
@ -122,8 +122,8 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
'private' => $privacy
|
'private' => $privacy
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
if ( ! empty($item['user_rating']))
|
if (is_numeric($item['user_rating']))
|
||||||
{
|
{
|
||||||
$untransformed['data']['rating'] = $item['user_rating'] / 2;
|
$untransformed['data']['rating'] = $item['user_rating'] / 2;
|
||||||
}
|
}
|
||||||
|
@ -117,10 +117,14 @@ class MangaListTransformer extends AbstractTransformer {
|
|||||||
'reconsuming' => $rereading,
|
'reconsuming' => $rereading,
|
||||||
'reconsumeCount' => (int)$item['reread_count'],
|
'reconsumeCount' => (int)$item['reread_count'],
|
||||||
'notes' => $item['notes'],
|
'notes' => $item['notes'],
|
||||||
'rating' => $item['new_rating'] / 2
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (is_numeric($item['new_rating']))
|
||||||
|
{
|
||||||
|
$map['data']['rating'] = $item['new_rating'] / 2;
|
||||||
|
}
|
||||||
|
|
||||||
return $map;
|
return $map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user