Only translate fields that are passed in

This commit is contained in:
Timothy Warren 2017-02-07 09:12:44 -05:00
parent 2f71a97327
commit 0fe01e14e1

View File

@ -63,16 +63,22 @@ class AnimeListTransformer extends AbstractTransformer {
'id' => $item['mal_id'], 'id' => $item['mal_id'],
'data' => [ 'data' => [
'episode' => $item['data']['progress'], 'episode' => $item['data']['progress'],
'status' => self::statusMap[$item['data']['status']],
'score' => (array_key_exists('rating', $item['data']))
? $item['data']['rating'] * 2
: "",
// 'enable_rewatching' => $rewatching, // 'enable_rewatching' => $rewatching,
// 'times_rewatched' => $item['data']['reconsumeCount'], // 'times_rewatched' => $item['data']['reconsumeCount'],
// 'comments' => $item['data']['notes'], // 'comments' => $item['data']['notes'],
] ]
]; ];
if (array_key_exists('rating', $item['data']))
{
$map['data']['score'] = $item['data']['rating'] * 2;
}
if (array_key_exists('status', $item['data']))
{
$map['data']['status'] = self::statusMap[$item['data']['status']];
}
return $map; return $map;
} }
} }