Remove a reference to genres from an older version of the Kitsu API
Some checks failed
timw4mail/HummingBirdAnimeClient/develop There was a failure building this commit

This commit is contained in:
Timothy Warren 2018-10-16 14:22:47 -04:00
parent 82520afa0e
commit 12dfb491bc
5 changed files with 54 additions and 45 deletions

72
Jenkinsfile vendored
View File

@ -1,37 +1,37 @@
pipeline { pipeline {
agent none agent none
stages { stages {
stage('PHP 7.1') { stage('PHP 7.1') {
agent { agent {
docker { docker {
image 'php:7.1-alpine' image 'php:7.1-alpine'
args '-u root --privileged' args '-u root --privileged'
} }
} }
steps { steps {
sh 'chmod +x ./build/docker_install.sh' sh 'chmod +x ./build/docker_install.sh'
sh 'sh build/docker_install.sh' sh 'sh build/docker_install.sh'
sh 'apk add --no-cache php7-phpdbg' sh 'apk add --no-cache php7-phpdbg'
sh 'curl -sS https://getcomposer.org/installer | php' sh 'curl -sS https://getcomposer.org/installer | php'
sh 'php composer.phar install --ignore-platform-reqs' sh 'php composer.phar install --ignore-platform-reqs'
sh 'phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never' sh 'phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never'
} }
} }
stage('PHP 7.2') { stage('PHP 7.2') {
agent { agent {
docker { docker {
image 'php:7.2-alpine' image 'php:7.2-alpine'
args '-u root --privileged' args '-u root --privileged'
} }
} }
steps { steps {
sh 'chmod +x ./build/docker_install.sh' sh 'chmod +x ./build/docker_install.sh'
sh 'sh build/docker_install.sh' sh 'sh build/docker_install.sh'
sh 'apk add --no-cache php7-phpdbg' sh 'apk add --no-cache php7-phpdbg'
sh 'curl -sS https://getcomposer.org/installer | php' sh 'curl -sS https://getcomposer.org/installer | php'
sh 'php composer.phar install --ignore-platform-reqs' sh 'php composer.phar install --ignore-platform-reqs'
sh 'phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never' sh 'phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never'
} }
} }
} }
} }

View File

@ -558,7 +558,7 @@ final class Model {
'media_type' => 'Anime', 'media_type' => 'Anime',
'status' => $status, 'status' => $status,
], ],
'include' => 'media,media.genres,media.mappings,anime.streamingLinks', 'include' => 'media,media.categories,media.mappings,anime.streamingLinks',
'sort' => '-updated_at' 'sort' => '-updated_at'
]; ];
@ -618,7 +618,7 @@ final class Model {
'media_type' => 'Manga', 'media_type' => 'Manga',
'status' => $status, 'status' => $status,
], ],
'include' => 'media,media.genres,media.mappings', 'include' => 'media,media.categories,media.mappings',
'page' => [ 'page' => [
'offset' => $offset, 'offset' => $offset,
'limit' => $limit 'limit' => $limit

View File

@ -42,7 +42,13 @@ final class AnimeListTransformer extends AbstractTransformer {
$animeId = $item['relationships']['media']['data']['id']; $animeId = $item['relationships']['media']['data']['id'];
$anime = $included['anime'][$animeId]; $anime = $included['anime'][$animeId];
$genres = array_column($anime['relationships']['genres'], 'name') ?? []; $genres = [];
foreach($anime['relationships']['categories'] as $genre)
{
$genres[] = $genre['title'];
}
sort($genres); sort($genres);
$rating = (int) $item['attributes']['ratingTwenty'] !== 0 $rating = (int) $item['attributes']['ratingTwenty'] !== 0

View File

@ -43,7 +43,13 @@ final class MangaListTransformer extends AbstractTransformer {
$mangaId = $item['relationships']['media']['data']['id']; $mangaId = $item['relationships']['media']['data']['id'];
$manga = $included['manga'][$mangaId]; $manga = $included['manga'][$mangaId];
$genres = array_column($manga['relationships']['genres'], 'name') ?? []; $genres = [];
foreach ($manga['relationships']['categories'] as $genre)
{
$genres[] = $genre['title'];
}
sort($genres); sort($genres);
$rating = (int) $item['attributes']['ratingTwenty'] !== 0 $rating = (int) $item['attributes']['ratingTwenty'] !== 0

View File

@ -35,12 +35,9 @@ final class MangaTransformer extends AbstractTransformer {
{ {
$genres = []; $genres = [];
foreach($item['included'] as $included) foreach($included['categories'] as $cat)
{ {
if ($included['type'] === 'categories') $genres[] = $cat['title'];
{
$genres[] = $included['attributes']['title'];
}
} }
sort($genres); sort($genres);