Fix mapping from Kitsu to MAL for updating a list item

This commit is contained in:
Timothy Warren 2017-02-13 12:42:05 -05:00
parent 8ddd2f5fd5
commit cfa23b8066

View File

@ -64,26 +64,36 @@ class AnimeListTransformer extends AbstractTransformer {
] ]
]; ];
switch(TRUE) $data =& $item['data'];
foreach($item['data'] as $key => $value)
{ {
case array_key_exists('notes', $item['data']): switch($key)
$map['data']['comments'] = $item['data']['notes']; {
case 'notes':
$map['data']['comments'] = $value;
break;
case array_key_exists('rating', $item['data']): case 'rating':
$map['data']['score'] = $item['data']['rating'] * 2; $map['data']['score'] = $value * 2;
break;
case array_key_exists('reconsuming', $item['data']): /* case 'reconsuming':
$map['data']['enable_rewatching'] = (bool) $item['data']['reconsuming']; $map['data']['enable_rewatching'] = (bool) $value;
break;
case array_key_exists('reconsumeCount', $item['data']): case 'reconsumeCount':
$map['data']['times_rewatched'] = $item['data']['reconsumeCount']; $map['data']['times_rewatched'] = $value;
break; */
case array_key_exists('status', $item['data']): case 'status':
$map['data']['status'] = self::statusMap[$item['data']['status']]; $map['data']['status'] = self::statusMap[$value];
break;
default: default:
break; break;
} }
}
return $map; return $map;
} }