Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
6 changed files with 42 additions and 9 deletions
Showing only changes of commit 59403b9cb5 - Show all commits

View File

@ -9,7 +9,7 @@
<a href="<?= $url->generate('anime.details', ['id' => $item['slug']]) ?>"> <a href="<?= $url->generate('anime.details', ['id' => $item['slug']]) ?>">
<?= $item['title'] ?> <?= $item['title'] ?>
</a> </a>
<?= (!empty($item['alternate_title'])) ? " <br /><small> " . $item['alternate_title'] . "</small>" : "" ?> <?= ! empty($item['alternate_title']) ? ' <br /><small> ' . $item['alternate_title'] . '</small>' : '' ?>
</td> </td>
<td><?= $item['episode_count'] ?></td> <td><?= $item['episode_count'] ?></td>
<td><?= $item['episode_length'] ?></td> <td><?= $item['episode_length'] ?></td>

View File

@ -1,5 +1,6 @@
a { a {
color: rgb(25, 120, 226); color: rgb(25, 120, 226);
text-shadow: var(--link-shadow);
} }
a:hover { a:hover {
@ -55,6 +56,23 @@ input, select, textarea {
color: #111; color: #111;
} }
.message, .static-message {
text-shadow: var(--white-link-shadow);
}
.message.success, .static-message.success {
background: #1f8454;
border-color: #70dda9;
}
.message.error, .static-message.error {
border-color:#f3e6e6;
background: #924949;
}
.message.info, .static-message.info {
border-color: #FFFFCC;
background: #bfbe3a;
}
.invisible tr, .invisible tr,
.invisible td, .invisible td,
.invisible th, .invisible th,

View File

@ -1 +1 @@
a{color:#1978e2}a:hover{color:#9e34fd}body,legend,nav ul li a{background:#333;color:#eee}nav a:hover,nav li.selected a{border-color:#fff}header button{background:transparent}table{-webkit-box-shadow:none;box-shadow:none}td,th{border-color:#111}thead td,thead th{background:#333;color:#eee}tbody>tr:nth-child(2n){background:#555;color:#eee}tbody>tr:nth-child(odd){background:#333}footer,hr,legend{border-color:#ddd}small{color:#fff}input,select,textarea{color:#111}.invisible tbody>tr:nth-child(2n),.invisible tbody>tr:nth-child(odd),.invisible td,.invisible th,.invisible tr{background:transparent}#main-nav{border-bottom:.1rem solid #ddd}.tabs,.vertical-tabs{background:#333}.tabs>label,.vertical-tabs .tab label{background:#222;border:0;color:#eee}.vertical-tabs .tab label{width:100%}.tabs>label:hover,.vertical-tabs .tab>label:hover{background:#888}.tabs>label:active,.vertical-tabs .tab>label:active{background:#999}.tabs>[type=radio]:checked+label,.tabs>[type=radio]:checked+label+.content,.vertical-tabs [type=radio]:checked+label,.vertical-tabs [type=radio]:checked~.content{border:0;background:#666;color:#eee}.vertical-tabs{background:#222;border:1px solid #444}.vertical-tabs .tab{background:#666;border-bottom:1px solid #444} a{color:#1978e2;text-shadow:var(--link-shadow)}a:hover{color:#9e34fd}body,legend,nav ul li a{background:#333;color:#eee}nav a:hover,nav li.selected a{border-color:#fff}header button{background:transparent}table{-webkit-box-shadow:none;box-shadow:none}td,th{border-color:#111}thead td,thead th{background:#333;color:#eee}tbody>tr:nth-child(2n){background:#555;color:#eee}tbody>tr:nth-child(odd){background:#333}footer,hr,legend{border-color:#ddd}small{color:#fff}input,select,textarea{color:#111}.message,.static-message{text-shadow:var(--white-link-shadow)}.message.success,.static-message.success{background:#1f8454;border-color:#70dda9}.message.error,.static-message.error{border-color:#f3e6e6;background:#924949}.message.info,.static-message.info{border-color:#ffc;background:#bfbe3a}.invisible tbody>tr:nth-child(2n),.invisible tbody>tr:nth-child(odd),.invisible td,.invisible th,.invisible tr{background:transparent}#main-nav{border-bottom:.1rem solid #ddd}.tabs,.vertical-tabs{background:#333}.tabs>label,.vertical-tabs .tab label{background:#222;border:0;color:#eee}.vertical-tabs .tab label{width:100%}.tabs>label:hover,.vertical-tabs .tab>label:hover{background:#888}.tabs>label:active,.vertical-tabs .tab>label:active{background:#999}.tabs>[type=radio]:checked+label,.tabs>[type=radio]:checked+label+.content,.vertical-tabs [type=radio]:checked+label,.vertical-tabs [type=radio]:checked~.content{border:0;background:#666;color:#eee}.vertical-tabs{background:#222;border:1px solid #444}.vertical-tabs .tab{background:#666;border-bottom:1px solid #444}

View File

@ -17,6 +17,7 @@
namespace Aviat\AnimeClient\API\Anilist\Transformer; namespace Aviat\AnimeClient\API\Anilist\Transformer;
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Anilist as AnilistStatus; use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Anilist as AnilistStatus;
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Kitsu as KitsuStatus;
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus; use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
use Aviat\AnimeClient\Types\{AnimeListItem, FormItem}; use Aviat\AnimeClient\Types\{AnimeListItem, FormItem};
@ -39,6 +40,8 @@ class AnimeListTransformer extends AbstractTransformer {
*/ */
public function untransform(array $item): FormItem public function untransform(array $item): FormItem
{ {
$reconsuming = $item['status'] === AnilistStatus::REPEATING;
return new FormItem([ return new FormItem([
'id' => $item['id'], 'id' => $item['id'],
'mal_id' => $item['media']['idMal'], 'mal_id' => $item['media']['idMal'],
@ -46,10 +49,12 @@ class AnimeListTransformer extends AbstractTransformer {
'notes' => $item['notes'] ?? '', 'notes' => $item['notes'] ?? '',
'private' => $item['private'], 'private' => $item['private'],
'progress' => $item['progress'], 'progress' => $item['progress'],
'rating' => $item['score'], 'rating' => $item['score'] ?? NULL,
'reconsumeCount' => $item['repeat'], 'reconsumeCount' => $item['repeat'],
'reconsuming' => $item['status'] === AnilistStatus::REPEATING, 'reconsuming' => $reconsuming,
'status' => AnimeWatchingStatus::ANILIST_TO_KITSU[$item['status']], 'status' => $reconsuming
? KitsuStatus::WATCHING
:AnimeWatchingStatus::ANILIST_TO_KITSU[$item['status']],
'updatedAt' => (new DateTime()) 'updatedAt' => (new DateTime())
->setTimestamp($item['updatedAt']) ->setTimestamp($item['updatedAt'])
->format(DateTime::W3C) ->format(DateTime::W3C)

View File

@ -268,7 +268,7 @@ final class SyncLists extends BaseCommand {
{ {
continue; continue;
} }
if (array_key_exists($mappingId, $includes['mappings'])) if (array_key_exists($mappingId, $includes['mappings']))
{ {
$malId = $includes['mappings'][$mappingId]['externalId']; $malId = $includes['mappings'][$mappingId]['externalId'];
@ -510,12 +510,16 @@ final class SyncLists extends BaseCommand {
// Use the first set rating, otherwise use the newer rating // Use the first set rating, otherwise use the newer rating
if ( ! $sameRating) if ( ! $sameRating)
{ {
if ($kitsuItem['data']['rating'] !== 0 && $dateDiff === 1) if (
$dateDiff === 1 &&
$kitsuItem['data']['rating'] !== 0 &&
$kitsuItem['data']['ratingTwenty'] !== 0
)
{ {
$update['data']['ratingTwenty'] = $kitsuItem['data']['ratingTwenty']; $update['data']['ratingTwenty'] = $kitsuItem['data']['ratingTwenty'];
$return['updateType'][] = 'anilist'; $return['updateType'][] = 'anilist';
} }
else if($dateDiff === -1) else if($dateDiff === -1 && $anilistItem['data']['rating'] !== 0)
{ {
$update['data']['ratingTwenty'] = $anilistItem['data']['rating'] * 2; $update['data']['ratingTwenty'] = $anilistItem['data']['rating'] * 2;
$return['updateType'][] = 'kitsu'; $return['updateType'][] = 'kitsu';
@ -552,6 +556,12 @@ final class SyncLists extends BaseCommand {
} }
} }
// No changes? Let's bail!
if (empty($return['updateType']))
{
return $return;
}
$return['meta'] = [ $return['meta'] = [
'kitsu' => $kitsuItem['data'], 'kitsu' => $kitsuItem['data'],
'anilist' => $anilistItem['data'], 'anilist' => $anilistItem['data'],

View File

@ -137,7 +137,7 @@ final class AnimeCollection extends BaseController {
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
public function edit() public function edit(): void
{ {
$data = $this->request->getParsedBody(); $data = $this->request->getParsedBody();
if (array_key_exists('hummingbird_id', $data)) if (array_key_exists('hummingbird_id', $data))