Don't show episode/chapter 0 in history
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good
This commit is contained in:
parent
badf941265
commit
b2c86adcf5
@ -73,7 +73,11 @@ abstract class HistoryTransformer {
|
||||
|
||||
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')
|
||||
{
|
||||
@ -170,7 +174,7 @@ abstract class HistoryTransformer {
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function transformProgress (array $entry): HistoryItem
|
||||
protected function transformProgress (array $entry): ?HistoryItem
|
||||
{
|
||||
$id = array_keys($entry['relationships'][$this->type])[0];
|
||||
$data = $entry['relationships'][$this->type][$id]['attributes'];
|
||||
@ -178,6 +182,12 @@ abstract class HistoryTransformer {
|
||||
$imgUrl = "images/{$this->type}/{$id}.webp";
|
||||
$item = end($entry['attributes']['changedData']['progress']);
|
||||
|
||||
// No showing episode 0 nonsense
|
||||
if (((int)$item) === 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$action = ($this->isReconsuming($entry))
|
||||
? "{$this->reconsumeAction} {$item}"
|
||||
: "{$this->progressAction} {$item}";
|
||||
|
Loading…
Reference in New Issue
Block a user