Version 5.1 - All the GraphQL #32
@ -8,7 +8,7 @@
|
||||
// Action to increment episode count
|
||||
_.on('body.anime.list', 'click', '.plus_one', (e) => {
|
||||
let parentSel = _.closestParent(e.target, 'article');
|
||||
let watchedCount = parseInt(_.$('.completed_number', parentSel)[0].textContent, 10);
|
||||
let watchedCount = parseInt(_.$('.completed_number', parentSel)[0].textContent, 10) || 0;
|
||||
let totalCount = parseInt(_.$('.total_number', parentSel)[0].textContent, 10);
|
||||
let title = _.$('.name a', parentSel)[0].textContent;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
let thisSel = e.target;
|
||||
let parentSel = _.closestParent(e.target, 'article');
|
||||
let type = thisSel.classList.contains('plus_one_chapter') ? 'chapter' : 'volume';
|
||||
let completed = parseInt(_.$(`.${type}s_read`, parentSel)[0].textContent, 10);
|
||||
let completed = parseInt(_.$(`.${type}s_read`, parentSel)[0].textContent, 10) || 0;
|
||||
let total = parseInt(_.$(`.${type}_count`, parentSel)[0].textContent, 10);
|
||||
let mangaName = _.$('.name', parentSel)[0].textContent;
|
||||
|
||||
|
@ -238,9 +238,9 @@ class Model {
|
||||
*
|
||||
* @param string $malId
|
||||
* @param string $type "anime" or "manga"
|
||||
* @return string
|
||||
* @return string|NULL
|
||||
*/
|
||||
public function getKitsuIdFromMALId(string $malId, string $type="anime"): string
|
||||
public function getKitsuIdFromMALId(string $malId, string $type="anime")
|
||||
{
|
||||
$options = [
|
||||
'query' => [
|
||||
@ -257,6 +257,11 @@ class Model {
|
||||
|
||||
$raw = $this->getRequest('mappings', $options);
|
||||
|
||||
if ( ! array_key_exists('included', $raw))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return $raw['included'][0]['id'];
|
||||
}
|
||||
|
||||
|
@ -120,11 +120,15 @@ class AnimeListTransformer extends AbstractTransformer {
|
||||
'reconsuming' => $rewatching,
|
||||
'reconsumeCount' => $item['rewatched'],
|
||||
'notes' => $item['notes'],
|
||||
'progress' => $item['episodes_watched'],
|
||||
'private' => $privacy
|
||||
]
|
||||
];
|
||||
|
||||
if (is_numeric($item['episodes_watched']) && $item['episodes_watched'] > 0)
|
||||
{
|
||||
$untransformed['data']['progress'] = (int) $item['episodes_watched'];
|
||||
}
|
||||
|
||||
if (is_numeric($item['user_rating']) && $item['user_rating'] > 0)
|
||||
{
|
||||
$untransformed['data']['rating'] = $item['user_rating'] / 2;
|
||||
|
@ -117,14 +117,18 @@ class MangaListTransformer extends AbstractTransformer {
|
||||
'mal_id' => $item['mal_id'],
|
||||
'data' => [
|
||||
'status' => $item['status'],
|
||||
'progress' => (int)$item['chapters_read'],
|
||||
'reconsuming' => $rereading,
|
||||
'reconsumeCount' => (int)$item['reread_count'],
|
||||
'notes' => $item['notes'],
|
||||
],
|
||||
];
|
||||
|
||||
if (is_numeric($item['new_rating']))
|
||||
if (is_numeric($item['chapters_read']) && $item['chapters_read'] > 0)
|
||||
{
|
||||
$map['data']['progress'] = (int)$item['chapters_read'];
|
||||
}
|
||||
|
||||
if (is_numeric($item['new_rating']) && $item['new_rating'] > 0)
|
||||
{
|
||||
$map['data']['rating'] = $item['new_rating'] / 2;
|
||||
}
|
||||
|
@ -118,6 +118,10 @@ class Index extends BaseController {
|
||||
// return $rawfavorites;
|
||||
$output = [];
|
||||
|
||||
unset($rawfavorites['data']);
|
||||
|
||||
// dump($rawfavorites);
|
||||
|
||||
foreach($rawfavorites as $item)
|
||||
{
|
||||
$rank = $item['attributes']['favRank'];
|
||||
|
Loading…
Reference in New Issue
Block a user