Replace 0 with -
This commit is contained in:
parent
6436ca2e9c
commit
7825e46321
@ -40,7 +40,9 @@ 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) $item['attributes']['rating'] !== 0
|
||||||
|
? (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']
|
||||||
@ -68,7 +70,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'mal_id' => $MALid,
|
'mal_id' => $MALid,
|
||||||
'episodes' => [
|
'episodes' => [
|
||||||
'watched' => (int) $item['attributes']['progress'] !== '0'
|
'watched' => (int) $item['attributes']['progress'] !== 0
|
||||||
? (int) $item['attributes']['progress']
|
? (int) $item['attributes']['progress']
|
||||||
: '-',
|
: '-',
|
||||||
'total' => $total_episodes,
|
'total' => $total_episodes,
|
||||||
@ -93,7 +95,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
'notes' => $item['attributes']['notes'],
|
'notes' => $item['attributes']['notes'],
|
||||||
'rewatching' => (bool) $item['attributes']['reconsuming'],
|
'rewatching' => (bool) $item['attributes']['reconsuming'],
|
||||||
'rewatched' => (int) $item['attributes']['reconsumeCount'],
|
'rewatched' => (int) $item['attributes']['reconsumeCount'],
|
||||||
'user_rating' => ($rating === 0) ? '-' : (int) $rating,
|
'user_rating' => $rating,
|
||||||
'private' => (bool) $item['attributes']['private'] ?? FALSE,
|
'private' => (bool) $item['attributes']['private'] ?? FALSE,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -42,18 +42,22 @@ class MangaListTransformer extends AbstractTransformer {
|
|||||||
$genres = array_column($manga['relationships']['genres'], 'name') ?? [];
|
$genres = array_column($manga['relationships']['genres'], 'name') ?? [];
|
||||||
sort($genres);
|
sort($genres);
|
||||||
|
|
||||||
$rating = (is_numeric($item['attributes']['rating']))
|
$rating = (int) $item['attributes']['rating'] !== 0
|
||||||
? intval(2 * $item['attributes']['rating'])
|
? (int) 2 * $item['attributes']['rating']
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
$totalChapters = ($manga['chapterCount'] > 0)
|
$totalChapters = ((int) $manga['chapterCount'] !== 0)
|
||||||
? $manga['chapterCount']
|
? $manga['chapterCount']
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
$totalVolumes = ($manga['volumeCount'] > 0)
|
$totalVolumes = ((int) $manga['volumeCount'] !== 0)
|
||||||
? $manga['volumeCount']
|
? $manga['volumeCount']
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
|
$readChapters = ((int) $item['attributes']['progress'] !== 0)
|
||||||
|
? $item['attributes']['progress']
|
||||||
|
: '-';
|
||||||
|
|
||||||
$MALid = NULL;
|
$MALid = NULL;
|
||||||
|
|
||||||
if (array_key_exists('mappings', $manga['relationships']))
|
if (array_key_exists('mappings', $manga['relationships']))
|
||||||
@ -72,7 +76,7 @@ class MangaListTransformer extends AbstractTransformer {
|
|||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'mal_id' => $MALid,
|
'mal_id' => $MALid,
|
||||||
'chapters' => [
|
'chapters' => [
|
||||||
'read' => $item['attributes']['progress'],
|
'read' => $readChapters,
|
||||||
'total' => $totalChapters
|
'total' => $totalChapters
|
||||||
],
|
],
|
||||||
'volumes' => [
|
'volumes' => [
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
'mal_id' => '33206',
|
'mal_id' => '33206',
|
||||||
'episodes' =>
|
'episodes' =>
|
||||||
array (
|
array (
|
||||||
'watched' => 0,
|
'watched' => '-',
|
||||||
'total' => '-',
|
'total' => '-',
|
||||||
'length' => NULL,
|
'length' => NULL,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user