Skip to content

Commit

Permalink
Merge pull request lardbit#166 from lardbit/fix-season-no-episodes
Browse files Browse the repository at this point in the history
UI Bug when tmdb season has no episodes assigned
  • Loading branch information
lardbit committed Jan 1, 2022
2 parents cdcc496 + 0df031c commit e4452fd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/frontend/src/app/media/media-t-v.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,19 @@ export class MediaTVComponent implements OnInit, OnDestroy {
return true;
}

// some tmdb seasons don't have any episodes attached
if (!season.episodes || season.episodes.length === 0) {
return false;
}

// verify every episode is collected
for (const episode of season.episodes) {
const watchEpisode = this._getWatchEpisode(episode.id);
if (!watchEpisode || !watchEpisode.collected) {
return false;
}
}

return true;
}

Expand All @@ -231,7 +237,7 @@ export class MediaTVComponent implements OnInit, OnDestroy {
watchingEpisodes += 1;
}
}
return season.episodes.length === watchingEpisodes;
return season.episodes.length > 0 && season.episodes.length === watchingEpisodes;
}

public isWatchingAnyEpisodeInSeason(season: any): boolean {
Expand Down

0 comments on commit e4452fd

Please sign in to comment.