Version 5.1 - All the GraphQL #32
@ -73,7 +73,11 @@ abstract class HistoryTransformer {
|
|||||||
|
|
||||||
if ($kind === 'progressed' && ! empty($entry['attributes']['changedData']['progress']))
|
if ($kind === 'progressed' && ! empty($entry['attributes']['changedData']['progress']))
|
||||||
{
|
{
|
||||||
$output[] = $this->transformProgress($entry);
|
$transformed = $this->transformProgress($entry);
|
||||||
|
if ($transformed !== NULL)
|
||||||
|
{
|
||||||
|
$output[] = $transformed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($kind === 'updated')
|
else if ($kind === 'updated')
|
||||||
{
|
{
|
||||||
@ -170,7 +174,7 @@ abstract class HistoryTransformer {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function transformProgress (array $entry): HistoryItem
|
protected function transformProgress (array $entry): ?HistoryItem
|
||||||
{
|
{
|
||||||
$id = array_keys($entry['relationships'][$this->type])[0];
|
$id = array_keys($entry['relationships'][$this->type])[0];
|
||||||
$data = $entry['relationships'][$this->type][$id]['attributes'];
|
$data = $entry['relationships'][$this->type][$id]['attributes'];
|
||||||
@ -178,6 +182,12 @@ abstract class HistoryTransformer {
|
|||||||
$imgUrl = "images/{$this->type}/{$id}.webp";
|
$imgUrl = "images/{$this->type}/{$id}.webp";
|
||||||
$item = end($entry['attributes']['changedData']['progress']);
|
$item = end($entry['attributes']['changedData']['progress']);
|
||||||
|
|
||||||
|
// No showing episode 0 nonsense
|
||||||
|
if (((int)$item) === 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
$action = ($this->isReconsuming($entry))
|
$action = ($this->isReconsuming($entry))
|
||||||
? "{$this->reconsumeAction} {$item}"
|
? "{$this->reconsumeAction} {$item}"
|
||||||
: "{$this->progressAction} {$item}";
|
: "{$this->progressAction} {$item}";
|
||||||
|
Loading…
Reference in New Issue
Block a user